32 lines · cpp
1void *D = 0;2 3class D {4 static int i;5};6 7int D::i = 3;8 9namespace errno {10 int j = 4;11};12 13int twice(int n)14{15 return n * 2; //% self.expect("expression -- D::i", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["int", "3"])16 //% self.expect("expression -- D", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["void"])17 //% self.expect("expression -- errno::j", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["int", "4"])18}19 20const char getAChar()21{22 const char D[] = "Hello world";23 return D[0]; //% self.expect("expression -- D::i", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["int", "3"])24 //% self.expect("expression -- D", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["char", "Hello"])25}26 27int main (int argc, char const *argv[])28{29 int six = twice(3);30 return 0; 31}32