From 86ba9dc908352839af581b1d4db1ef349efd5b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Debrard?= Date: Sun, 23 Jan 2011 16:32:33 +0100 Subject: [PATCH] sizeof --- test/testsimplifytokens.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 631c331c5..0e898e5c2 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -84,6 +84,7 @@ private: TEST_CASE(sizeof19); // #1891 - sizeof 'x' TEST_CASE(sizeof20); // #2024 - sizeof a) TEST_CASE(sizeof21); // #2232 - sizeof...(Args) + TEST_CASE(sizeof22); // #155 TEST_CASE(sizeofsizeof); TEST_CASE(casting); @@ -849,6 +850,7 @@ private: " sizeof(*i);\n" "}\n"; ASSERT_EQUALS("void foo ( ) { int i [ 4 ] ; 16 ; 4 ; }", sizeof_(code)); + TODO_ASSERT_EQUALS("void foo ( ) { int i [ 4 ] ; 4 ; 4 ; }", sizeof_(code)); } void sizeof3() @@ -860,6 +862,7 @@ private: " sizeof(i);\n" "}\n"; ASSERT_EQUALS("static int i [ 4 ] ; void f ( ) { int i [ 10 ] ; 40 ; }", sizeof_(code)); + TODO_ASSERT_EQUALS("static int i [ 4 ] ; void f ( ) { int i [ 10 ] ; 10 ; }", sizeof_(code)); } void sizeof4() @@ -1408,6 +1411,36 @@ private: tok(code); } + void sizeof22() + { + { + const char code[] = "void foo(int i[10])\n" + "{\n" + " sizeof(i);\n" + " sizeof(*i);\n" + "}\n"; + TODO_ASSERT_EQUALS("void foo ( ) { sizeof ( i ) ; 4 ; }", sizeof_(code)); + } + + { + const char code[] = "void foo(int i[])\n" + "{\n" + " sizeof(i);\n" + " sizeof(*i);\n" + "}\n"; + TODO_ASSERT_EQUALS("void foo ( ) { sizeof ( i ) ; 4 ; }", sizeof_(code)); + } + + { + const char code[] = "void foo(int i[])\n" + "{\n" + " sizeof i;\n" + " sizeof(*i);\n" + "}\n"; + TODO_ASSERT_EQUALS("void foo ( ) { sizeof ( i ) ; 4 ; }", sizeof_(code)); + } + } + void sizeofsizeof() {