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, c;
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     memcpy(c.data, "F\0O\0AR", 7);
17     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"))
18     const char* constcharstar = stdstring.c_str();
19     std::string longstring(
20 "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"
21 " 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"
22 " 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.."
23 " for science, or something"
24       "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"
25       " 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"
26       " 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.."
27       " for science, or something"
28             "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"
29             " 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"
30             " 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.."
31             " for science, or something"
32       );
33     const char* longconstcharstar = longstring.c_str();
34     return 0;     //% if self.TraceOn(): self.runCmd('frame variable')
35     //% self.expect_var_path('stdstring', summary='"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"')
36     //% self.expect_var_path('constcharstar', summary='"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"')
37     //% self.expect_var_path("a.data", summary='"FOOB"')
38     //% self.expect_var_path("b.data", summary=r'"FO\0B"')
39     //% self.expect_var_path("c.data", summary=r'"F\0O"')
40     //%
41     //% self.runCmd("setting set escape-non-printables false")
42     //% self.expect_var_path('stdstring', summary='"Hello\t\tWorld\nI am here\t\tto say hello\n"')
43     //% self.expect_var_path('constcharstar', summary='"Hello\t\tWorld\nI am here\t\tto say hello\n"')
44     //% self.assertTrue(self.frame().FindVariable('longstring').GetSummary().endswith('"...'))
45     //% self.assertTrue(self.frame().FindVariable('longconstcharstar').GetSummary().endswith('"...'))
46     // FIXME: make "b.data" and "c.data" work sanely
47 }
48 
49