1 #include <string>
2 #include <cstring>
3 
4 struct A {
5   char data[4];
6   char overflow[4];
7 };
8 
9 int main (int argc, char const *argv[])
10 {
11     A a, b;
12     // Deliberately write past the end of data to test that the formatter stops
13     // at the end of array.
14     memcpy(a.data, "FOOBAR", 7);
15     memcpy(b.data, "FO\0BAR", 7);
16     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"))
17     const char* constcharstar = stdstring.c_str();
18     std::string longstring(
19 "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"
20 " 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"
21 " 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.."
22 " for science, or something"
23       "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"
24       " 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"
25       " 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.."
26       " for science, or something"
27             "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"
28             " 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"
29             " 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.."
30             " for science, or something"
31       );
32     const char* longconstcharstar = longstring.c_str();
33     return 0;     //% if self.TraceOn(): self.runCmd('frame variable')
34     //% self.expect_var_path('stdstring', summary='"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"')
35     //% self.expect_var_path('constcharstar', summary='"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"')
36     //% self.runCmd("setting set escape-non-printables false")
37     //% self.expect_var_path('stdstring', summary='"Hello\t\tWorld\nI am here\t\tto say hello\n"')
38     //% self.expect_var_path('constcharstar', summary='"Hello\t\tWorld\nI am here\t\tto say hello\n"')
39     //% self.assertTrue(self.frame().FindVariable('longstring').GetSummary().endswith('"...'))
40     //% self.assertTrue(self.frame().FindVariable('longconstcharstar').GetSummary().endswith('"...'))
41     //% self.expect_var_path("a.data", summary='"FOOB"')
42     // FIXME: Should this be "FO\0B" instead?
43     //% self.expect_var_path("b.data", summary='"FO"')
44 }
45 
46