Added test case TestTokenizer::sizeof5

This commit is contained in:
Reijo Tomperi 2009-02-14 21:49:36 +00:00
parent 1e07847ecf
commit 669913568c
1 changed files with 23 additions and 1 deletions

View File

@ -111,6 +111,7 @@ private:
TEST_CASE(sizeof2);
TEST_CASE(sizeof3);
TEST_CASE(sizeof4);
// TODO (ticket #108) TEST_CASE(sizeof5);
TEST_CASE(simplify_numeric_condition);
TEST_CASE(tokenize_double);
TEST_CASE(tokenize_strings);
@ -1024,7 +1025,6 @@ private:
ASSERT_EQUALS(std::string(" int i [ 10 ] ; 4 ;"), ostr.str());
}
void sizeof4()
{
const char code[] =
@ -1045,6 +1045,28 @@ private:
ASSERT_EQUALS(std::string(" for ( int i = 0 ; i < 100 ; i ++ ) { }"), ostr.str());
}
void sizeof5()
{
const char code[] = "int i;\n"
"sizeof(i);\n";
// tokenize..
Tokenizer tokenizer;
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
tokenizer.simplifyTokenList();
std::ostringstream ostr;
for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next())
ostr << " " << tok->str();
std::ostringstream oss;
oss << " int i ; " << sizeof(int);
ASSERT_EQUALS(oss.str(), ostr.str());
}
void simplify_numeric_condition()
{
const char code[] =