Remove useless preprocessor pieces from some testcases.

This commit is contained in:
Edoardo Prezioso 2012-11-30 12:40:22 +01:00
parent 45b77554ea
commit 47f1220367
4 changed files with 11 additions and 20 deletions

View File

@ -118,11 +118,10 @@ private:
} }
void division5() { void division5() {
check("#define USER_HASH (16)\n" check("void foo()\n"
"void foo()\n"
"{\n" "{\n"
" unsigned int val = 32;\n" " unsigned int val = 32;\n"
" val = val / USER_HASH;" " val = val / (16);\n"
"}", true); "}", true);
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }

View File

@ -74,11 +74,7 @@ private:
check("void foo()\n" check("void foo()\n"
"{\n" "{\n"
" const char def[] =\n" " const char def[] =\n"
"#ifdef ABC\n"
" \"abc\";\n" " \"abc\";\n"
"#else\n"
" \"not abc\";\n"
"#endif\n"
"}\n"); "}\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());

View File

@ -4985,19 +4985,16 @@ private:
void duplicateIf1() { // ticket 3689 ( avoid false positive ) void duplicateIf1() { // ticket 3689 ( avoid false positive )
check("#define INT32_MAX 0x7fffffffLL\n" check("int fitInt(long long int nValue){\n"
"#define INT48_MAX 0x7fffffffffffLL\n" " if( nValue < 0x7fffffffLL )\n"
"#define INT64_MAX 0x7fffffffffffffffLL\n"
"int fitInt(long long int nValue){\n"
" if( nValue < INT32_MAX )\n"
" {\n" " {\n"
" return 32;\n" " return 32;\n"
" }\n" " }\n"
" if( nValue < INT48_MAX )\n" " if( nValue < 0x7fffffffffffLL )\n"
" {\n" " {\n"
" return 48;\n" " return 48;\n"
" }\n" " }\n"
" else if( nValue < INT64_MAX )\n" " else if( nValue < 0x7fffffffffffffffLL )\n"
" {\n" " {\n"
" return 64;\n" " return 64;\n"
" } else\n" " } else\n"

View File

@ -5792,12 +5792,11 @@ private:
} }
void simplifyTypedef98() { // ticket #2963 void simplifyTypedef98() { // ticket #2963
//TODO: this testcase fails because "inconclusive" and "style" are not enabled in "tok". const char code[] = "typedef int type ## __LINE__;\n"
const char code[] = "#define X type ## __LINE__\n" "typedef int type ## __LINE__;\n"
"typedef int X;\n" "type1 x;\n"
"typedef int X;\n"; "type2 y;";
tok(code); ASSERT_EQUALS("int x ; int y ;", tok(code));
ASSERT_EQUALS("", errout.str());
} }
void simplifyTypedef99() { // ticket #2999 void simplifyTypedef99() { // ticket #2999