199451b44SJordan Rupprecht #include <string>
28093c2eaSPavel Labath #include <cstring>
38093c2eaSPavel Labath 
48093c2eaSPavel Labath struct A {
58093c2eaSPavel Labath   char data[4];
68093c2eaSPavel Labath   char overflow[4];
78093c2eaSPavel Labath };
899451b44SJordan Rupprecht 
999451b44SJordan Rupprecht int main (int argc, char const *argv[])
1099451b44SJordan Rupprecht {
11*ca0ce99fSPavel Labath     A a, b, c;
128093c2eaSPavel Labath     // Deliberately write past the end of data to test that the formatter stops
138093c2eaSPavel Labath     // at the end of array.
148093c2eaSPavel Labath     memcpy(a.data, "FOOBAR", 7);
158093c2eaSPavel Labath     memcpy(b.data, "FO\0BAR", 7);
16*ca0ce99fSPavel Labath     memcpy(c.data, "F\0O\0AR", 7);
1799451b44SJordan 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"))
1899451b44SJordan Rupprecht     const char* constcharstar = stdstring.c_str();
1999451b44SJordan Rupprecht     std::string longstring(
2099451b44SJordan 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"
2199451b44SJordan 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"
2299451b44SJordan 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.."
2399451b44SJordan Rupprecht " for science, or something"
2499451b44SJordan 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"
2599451b44SJordan 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"
2699451b44SJordan 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.."
2799451b44SJordan Rupprecht       " for science, or something"
2899451b44SJordan 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"
2999451b44SJordan 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"
3099451b44SJordan 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.."
3199451b44SJordan Rupprecht             " for science, or something"
3299451b44SJordan Rupprecht       );
3399451b44SJordan Rupprecht     const char* longconstcharstar = longstring.c_str();
3499451b44SJordan Rupprecht     return 0;     //% if self.TraceOn(): self.runCmd('frame variable')
358093c2eaSPavel Labath     //% self.expect_var_path('stdstring', summary='"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"')
368093c2eaSPavel Labath     //% self.expect_var_path('constcharstar', summary='"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"')
37*ca0ce99fSPavel Labath     //% self.expect_var_path("a.data", summary='"FOOB"')
38*ca0ce99fSPavel Labath     //% self.expect_var_path("b.data", summary=r'"FO\0B"')
39*ca0ce99fSPavel Labath     //% self.expect_var_path("c.data", summary=r'"F\0O"')
40*ca0ce99fSPavel Labath     //%
4199451b44SJordan Rupprecht     //% self.runCmd("setting set escape-non-printables false")
428093c2eaSPavel Labath     //% self.expect_var_path('stdstring', summary='"Hello\t\tWorld\nI am here\t\tto say hello\n"')
438093c2eaSPavel Labath     //% self.expect_var_path('constcharstar', summary='"Hello\t\tWorld\nI am here\t\tto say hello\n"')
4499451b44SJordan Rupprecht     //% self.assertTrue(self.frame().FindVariable('longstring').GetSummary().endswith('"...'))
4599451b44SJordan Rupprecht     //% self.assertTrue(self.frame().FindVariable('longconstcharstar').GetSummary().endswith('"...'))
46*ca0ce99fSPavel Labath     // FIXME: make "b.data" and "c.data" work sanely
4799451b44SJordan Rupprecht }
4899451b44SJordan Rupprecht 
49