TODO test cases TestTokenizer::vardec_static added

This commit is contained in:
Reijo Tomperi 2009-10-02 17:28:30 +03:00
parent 6989670e8f
commit 107895e8cc
1 changed files with 33 additions and 6 deletions

View File

@ -138,7 +138,7 @@ private:
TEST_CASE(vardecl2); TEST_CASE(vardecl2);
TEST_CASE(vardecl3); TEST_CASE(vardecl3);
TEST_CASE(vardecl4); TEST_CASE(vardecl4);
TEST_CASE(vardecl5); TEST_CASE(vardec_static);
TEST_CASE(vardecl6); TEST_CASE(vardecl6);
TEST_CASE(vardecl7); TEST_CASE(vardecl7);
TEST_CASE(vardecl8); TEST_CASE(vardecl8);
@ -2291,12 +2291,39 @@ private:
ASSERT_EQUALS(res3, tokenizeAndStringify(code3)); ASSERT_EQUALS(res3, tokenizeAndStringify(code3));
} }
void vardecl5() void vardec_static()
{ {
// don't simplify declarations of static variables {
// "static int i = 0;" is not the same as "static int i; i = 0;" // don't simplify declarations of static variables
const char code[] = "static int i = 0 ;"; // "static int i = 0;" is not the same as "static int i; i = 0;"
ASSERT_EQUALS(code, tokenizeAndStringify(code)); const char code[] = "static int i = 0 ;";
ASSERT_EQUALS(code, tokenizeAndStringify(code));
}
{
const char code[] = "static int a, b;";
TODO_ASSERT_EQUALS("static int a ; static int b ;", tokenizeAndStringify(code));
}
{
const char code[] = "static unsigned int a, b;";
TODO_ASSERT_EQUALS("static unsigned int a ; static unsigned int b ;", tokenizeAndStringify(code));
}
{
const char code[] = "static int a=1, b=1;";
TODO_ASSERT_EQUALS("static int a = 1 ; static int b = 1 ;", tokenizeAndStringify(code));
}
{
const char code[] = "static int *a, *b;";
TODO_ASSERT_EQUALS("static int * a ; static int * b ;", tokenizeAndStringify(code));
}
{
const char code[] = "static unsigned int *a=0, *b=0;";
TODO_ASSERT_EQUALS("static unsigned int * a = 0 ; static unsigned int * b = 0 ;", tokenizeAndStringify(code));
}
} }
void vardecl6() void vardecl6()