diff --git a/test/testother.cpp b/test/testother.cpp index 908dbe18a..b2ed30723 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -2760,6 +2760,20 @@ private: "}"); ASSERT_EQUALS("[test.cpp:7]: (warning) Redundant bitwise operation on 'y' in 'switch' statement. 'break;' missing?\n", errout.str()); + check("void foo(int a)\n" + "{\n" + " int y = 1;\n" + " switch (a)\n" + " {\n" + " case 2:\n" + " y = y | 3;\n" + " case 3:\n" + " y = y | 3;\n" + " break;\n" + " }\n" + "}"); + ASSERT_EQUALS("[test.cpp:7]: (warning) Redundant bitwise operation on 'y' in 'switch' statement. 'break;' missing?\n", errout.str()); + check("void foo(int a)\n" "{\n" " int y = 1;\n" @@ -6975,6 +6989,14 @@ private: "}"); ASSERT_EQUALS("[test.cpp:3]: (warning) Storing getchar() return value in char variable and then comparing with EOF.\n", errout.str()); + check("void f() {\n" + " unsigned char c;\n" + " while( EOF != ( c = getchar() ) )\n" + " {\n" + " }\n" + "}"); + ASSERT_EQUALS("[test.cpp:3]: (warning) Storing getchar() return value in char variable and then comparing with EOF.\n", errout.str()); + check("void f() {\n" " unsigned char c;\n" " while( EOF != ( c = getchar() ) )\n"