Added test cases for #487.

This commit is contained in:
Slava Semushin 2009-09-06 18:28:25 +07:00
parent 572c206755
commit c1958054af
1 changed files with 35 additions and 0 deletions

View File

@ -64,6 +64,7 @@ private:
TEST_CASE(sizeof6);
TEST_CASE(sizeof7);
TEST_CASE(sizeof8);
TEST_CASE(sizeof9);
TEST_CASE(casting);
TEST_CASE(template1);
@ -612,6 +613,40 @@ private:
}
}
void sizeof9()
{
// ticket #487
{
const char code[] = "const char *str = \"1\"; sizeof(str);";
const char *str = "1";
std::ostringstream expected;
expected << " const char * str ; str = \"1\" ; " << sizeof(str) << " ;";
TODO_ASSERT_EQUALS(expected.str(), sizeof_(code));
}
{
const char code[] = "const char str[] = \"1\"; sizeof(str);";
const char str[] = "1";
std::ostringstream expected;
expected << " const char * str ; str = \"1\" ; " << sizeof(str) << " ;";
TODO_ASSERT_EQUALS(expected.str(), sizeof_(code));
}
{
const char code[] = "const char str[] = {'1'}; sizeof(str);";
const char str[] = {'1'};
std::ostringstream expected;
expected << " const char * str ; str = { '1' } ; " << sizeof(str) << " ;";
TODO_ASSERT_EQUALS(expected.str(), sizeof_(code));
}
}
void casting()
{
{