You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testother.cpp
+27-3Lines changed: 27 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -4953,13 +4953,13 @@ class TestOther : public TestFixture {
4953
4953
" const int i = sizeof(int);\n"
4954
4954
" if ( i != sizeof (int)){}\n"
4955
4955
"}\n");
4956
-
TODO_ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'i != sizeof(int)' is always false because 'i' and 'sizeof(int)' represent the same value.\n", "", errout.str());
4956
+
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'i != sizeof(int)' is always false because 'i' and 'sizeof(int)' represent the same value.\n", errout.str());
4957
4957
4958
4958
check("void f() {\n"
4959
4959
" const int i = sizeof(int);\n"
4960
4960
" if ( sizeof (int) != i){}\n"
4961
4961
"}\n");
4962
-
TODO_ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'sizeof(int) != i' is always false because 'sizeof(int)' and 'i' represent the same value.\n", "", errout.str());
4962
+
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'sizeof(int) != i' is always false because 'sizeof(int)' and 'i' represent the same value.\n", errout.str());
4963
4963
4964
4964
check("void f(int a = 1) { if ( a != 1){}}\n");
4965
4965
ASSERT_EQUALS("", errout.str());
@@ -5100,7 +5100,7 @@ class TestOther : public TestFixture {
5100
5100
check("struct A { int f() const; };\n"
5101
5101
"A g();\n"
5102
5102
"void foo() {\n"
5103
-
" for (const A x = A();;) {\n"
5103
+
" for (A x = A();;) {\n"
5104
5104
" const int a = x.f();\n"
5105
5105
" x = g();\n"
5106
5106
" if (x.f() == a) break;\n"
@@ -5506,6 +5506,30 @@ class TestOther : public TestFixture {
5506
5506
" if (!b && g()) {}\n"
5507
5507
"}\n");
5508
5508
ASSERT_EQUALS("", errout.str());
5509
+
5510
+
check("void f(bool *a) {\n"
5511
+
" const bool b = a[42];\n"
5512
+
" if( b == !(a[42]) ) {}\n"
5513
+
"}\n");
5514
+
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) Opposite expression on both sides of '=='.\n", errout.str());
5515
+
5516
+
check("void f(bool *a) {\n"
5517
+
" const bool b = a[42];\n"
5518
+
" if( a[42] == !(b) ) {}\n"
5519
+
"}\n");
5520
+
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) Opposite expression on both sides of '=='.\n", errout.str());
5521
+
5522
+
check("void f(bool *a) {\n"
5523
+
" const bool b = *a;\n"
5524
+
" if( b == !(*a) ) {}\n"
5525
+
"}\n");
5526
+
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) Opposite expression on both sides of '=='.\n", errout.str());
5527
+
5528
+
check("void f(bool *a) {\n"
5529
+
" const bool b = *a;\n"
5530
+
" if( *a == !(b) ) {}\n"
5531
+
"}\n");
5532
+
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) Opposite expression on both sides of '=='.\n", errout.str());
0 commit comments