Preprocessor : Added a few more testcases for the macro expansion

This commit is contained in:
Daniel Marjamäki 2009-01-05 20:41:34 +00:00
parent 3b2827a7ba
commit 4642fc25aa
1 changed files with 19 additions and 1 deletions

View File

@ -67,6 +67,8 @@ private:
// Macros.. // Macros..
TEST_CASE(macro1); TEST_CASE(macro1);
TEST_CASE(macro2);
TEST_CASE(macro3);
} }
@ -463,7 +465,23 @@ private:
void macro1() void macro1()
{ {
ASSERT_EQUALS("\nf(5);\n", Preprocessor::expandMacros("#define AAA(aa) f(aa)\nAAA(5);\n")); const char filedata[] = "#define AAA(aa) f(aa)\n"
"AAA(5);\n";
ASSERT_EQUALS("\nf(5);\n", Preprocessor::expandMacros(filedata));
}
void macro2()
{
const char filedata[] = "#define min(x,y) x<y?x:y\n"
"min(a(),b());\n";
ASSERT_EQUALS("\na()<b()?a():b();\n", Preprocessor::expandMacros(filedata));
}
void macro3()
{
const char filedata[] = "#define AAA(aa,bb) f(aa)\n"
"AAA(5);\n";
ASSERT_EQUALS("\nAAA(5);\n", Preprocessor::expandMacros(filedata));
} }