TestTokenizer : Split the test TestTokenizer::simplifyKnownVariables into 5 separate tests

This commit is contained in:
Daniel Marjamäki 2008-12-22 18:08:32 +00:00
parent 7a3fd268e1
commit 3a4e113f64
1 changed files with 116 additions and 110 deletions

View File

@ -52,9 +52,13 @@ private:
TEST_CASE( numeric_true_condition ); TEST_CASE( numeric_true_condition );
TEST_CASE( simplify_known_variables ); TEST_CASE( simplifyKnownVariables1 );
TEST_CASE( simplifyKnownVariables2 );
TEST_CASE( simplifyKnownVariables3 );
TEST_CASE( simplifyKnownVariables4 );
TEST_CASE( simplifyKnownVariables5 );
TEST_CASE( multi_compare ); TEST_CASE( multiCompare );
TEST_CASE( match1 ); TEST_CASE( match1 );
@ -284,8 +288,7 @@ private:
ASSERT_EQUALS( std::string(" void f ( ) { if ( a ) { for ( ; ; ) { } } }"), ostr.str() ); ASSERT_EQUALS( std::string(" void f ( ) { if ( a ) { for ( ; ; ) { } } }"), ostr.str() );
} }
void simplify_known_variables() void simplifyKnownVariables1()
{
{ {
const char code[] = "void f()\n" const char code[] = "void f()\n"
"{\n" "{\n"
@ -307,6 +310,7 @@ private:
ASSERT_EQUALS( std::string(" void f ( ) { int a = 10 ; if ( 10 ) ; }"), ostr.str() ); ASSERT_EQUALS( std::string(" void f ( ) { int a = 10 ; if ( 10 ) ; }"), ostr.str() );
} }
void simplifyKnownVariables2()
{ {
const char code[] = "void f()\n" const char code[] = "void f()\n"
"{\n" "{\n"
@ -329,6 +333,7 @@ private:
ASSERT_EQUALS( std::string(" void f ( ) { int a = 10 ; a = g ( ) ; if ( a ) ; }"), ostr.str() ); ASSERT_EQUALS( std::string(" void f ( ) { int a = 10 ; a = g ( ) ; if ( a ) ; }"), ostr.str() );
} }
void simplifyKnownVariables3()
{ {
const char code[] = "void f()\n" const char code[] = "void f()\n"
"{\n" "{\n"
@ -354,6 +359,7 @@ private:
ASSERT_EQUALS( std::string(" void f ( ) { int a = 4 ; while ( true ) { break ; a = 10 ; } if ( a ) ; }"), ostr.str() ); ASSERT_EQUALS( std::string(" void f ( ) { int a = 4 ; while ( true ) { break ; a = 10 ; } if ( a ) ; }"), ostr.str() );
} }
void simplifyKnownVariables4()
{ {
const char code[] = "void f()\n" const char code[] = "void f()\n"
"{\n" "{\n"
@ -375,6 +381,7 @@ private:
ASSERT_EQUALS( std::string(" void f ( ) { int a = 4 ; if ( g ( a ) ) ; }"), ostr.str() ); ASSERT_EQUALS( std::string(" void f ( ) { int a = 4 ; if ( g ( a ) ) ; }"), ostr.str() );
} }
void simplifyKnownVariables5()
{ {
const char code[] = "void f()\n" const char code[] = "void f()\n"
"{\n" "{\n"
@ -395,9 +402,8 @@ private:
ostr << " " << tok->str(); ostr << " " << tok->str();
ASSERT_EQUALS( std::string(" void f ( ) { int a = 4 ; if ( a = 5 ) ; }"), ostr.str() ); ASSERT_EQUALS( std::string(" void f ( ) { int a = 4 ; if ( a = 5 ) ; }"), ostr.str() );
} }
}
void multi_compare() void multiCompare()
{ {
// Test for found // Test for found
ASSERT_EQUALS( 1, TOKEN::multiCompare( "one|two", "one" ) ); ASSERT_EQUALS( 1, TOKEN::multiCompare( "one|two", "one" ) );