199451b44SJordan Rupprecht #include <string> 2*8093c2eaSPavel Labath #include <cstring> 3*8093c2eaSPavel Labath 4*8093c2eaSPavel Labath struct A { 5*8093c2eaSPavel Labath char data[4]; 6*8093c2eaSPavel Labath char overflow[4]; 7*8093c2eaSPavel Labath }; 899451b44SJordan Rupprecht 999451b44SJordan Rupprecht int main (int argc, char const *argv[]) 1099451b44SJordan Rupprecht { 11*8093c2eaSPavel Labath A a, b; 12*8093c2eaSPavel Labath // Deliberately write past the end of data to test that the formatter stops 13*8093c2eaSPavel Labath // at the end of array. 14*8093c2eaSPavel Labath memcpy(a.data, "FOOBAR", 7); 15*8093c2eaSPavel Labath memcpy(b.data, "FO\0BAR", 7); 1699451b44SJordan Rupprecht std::string stdstring("Hello\t\tWorld\nI am here\t\tto say hello\n"); //%self.addTearDownHook(lambda x: x.runCmd("setting set escape-non-printables true")) 1799451b44SJordan Rupprecht const char* constcharstar = stdstring.c_str(); 1899451b44SJordan Rupprecht std::string longstring( 1999451b44SJordan Rupprecht "I am a very long string; in fact I am longer than any reasonable length that a string should be; quite long indeed; oh my, so many words; so many letters; this is kind of like writing a poem; except in real life all that is happening" 2099451b44SJordan Rupprecht " is just me producing a very very long set of words; there is text here, text there, text everywhere; it fills me with glee to see so much text; all around me it's just letters, and symbols, and other pleasant drawings that cause me" 2199451b44SJordan Rupprecht " a large amount of joy upon visually seeing them with my eyes; well, this is now a lot of letters, but it is still not enough for the purpose of the test I want to test, so maybe I should copy and paste this a few times, you know.." 2299451b44SJordan Rupprecht " for science, or something" 2399451b44SJordan Rupprecht "I am a very long string; in fact I am longer than any reasonable length that a string should be; quite long indeed; oh my, so many words; so many letters; this is kind of like writing a poem; except in real life all that is happening" 2499451b44SJordan Rupprecht " is just me producing a very very long set of words; there is text here, text there, text everywhere; it fills me with glee to see so much text; all around me it's just letters, and symbols, and other pleasant drawings that cause me" 2599451b44SJordan Rupprecht " a large amount of joy upon visually seeing them with my eyes; well, this is now a lot of letters, but it is still not enough for the purpose of the test I want to test, so maybe I should copy and paste this a few times, you know.." 2699451b44SJordan Rupprecht " for science, or something" 2799451b44SJordan Rupprecht "I am a very long string; in fact I am longer than any reasonable length that a string should be; quite long indeed; oh my, so many words; so many letters; this is kind of like writing a poem; except in real life all that is happening" 2899451b44SJordan Rupprecht " is just me producing a very very long set of words; there is text here, text there, text everywhere; it fills me with glee to see so much text; all around me it's just letters, and symbols, and other pleasant drawings that cause me" 2999451b44SJordan Rupprecht " a large amount of joy upon visually seeing them with my eyes; well, this is now a lot of letters, but it is still not enough for the purpose of the test I want to test, so maybe I should copy and paste this a few times, you know.." 3099451b44SJordan Rupprecht " for science, or something" 3199451b44SJordan Rupprecht ); 3299451b44SJordan Rupprecht const char* longconstcharstar = longstring.c_str(); 3399451b44SJordan Rupprecht return 0; //% if self.TraceOn(): self.runCmd('frame variable') 34*8093c2eaSPavel Labath //% self.expect_var_path('stdstring', summary='"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"') 35*8093c2eaSPavel Labath //% self.expect_var_path('constcharstar', summary='"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"') 3699451b44SJordan Rupprecht //% self.runCmd("setting set escape-non-printables false") 37*8093c2eaSPavel Labath //% self.expect_var_path('stdstring', summary='"Hello\t\tWorld\nI am here\t\tto say hello\n"') 38*8093c2eaSPavel Labath //% self.expect_var_path('constcharstar', summary='"Hello\t\tWorld\nI am here\t\tto say hello\n"') 3999451b44SJordan Rupprecht //% self.assertTrue(self.frame().FindVariable('longstring').GetSummary().endswith('"...')) 4099451b44SJordan Rupprecht //% self.assertTrue(self.frame().FindVariable('longconstcharstar').GetSummary().endswith('"...')) 41*8093c2eaSPavel Labath //% self.expect_var_path("a.data", summary='"FOOB"') 42*8093c2eaSPavel Labath // FIXME: Should this be "FO\0B" instead? 43*8093c2eaSPavel Labath //% self.expect_var_path("b.data", summary='"FO"') 4499451b44SJordan Rupprecht } 4599451b44SJordan Rupprecht 46