diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 3bcaab2c1af..fabc174d9f0 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -6377,6 +6377,57 @@ class TestCondition : public TestFixture { ASSERT_EQUALS( "[test.cpp:3]: (style) Condition 'nf>+1.0' is always false\n", errout_str()); + + check("void foo() {\n" // #11200 + " float f = 1.0;\n" + " if (f > -1.0) {}\n" + "}\n"); + ASSERT_EQUALS( + "[test.cpp:3]: (style) Condition 'f>-1.0' is always true\n", + errout_str()); + + check("void foo() {\n" // #13508 + " float f = 1.0;\n" + " if (f > 1.0) {}\n" + "}\n"); + TODO_ASSERT_EQUALS( + "[test.cpp:3]: (style) Condition 'f>1.0' is always true\n", + "", + errout_str()); + + check("void foo() {\n" // #11200 + " float pf = +1.0;\n" + " if (pf > -1.0) {}\n" + "}\n"); + ASSERT_EQUALS( + "[test.cpp:3]: (style) Condition 'pf>-1.0' is always true\n", + errout_str()); + + check("void foo() {\n" // #13508 + " float pf = +1.0;\n" + " if (pf > 1.0) {}\n" + "}\n"); + TODO_ASSERT_EQUALS( + "[test.cpp:3]: (style) Condition 'pf>1.0' is always true\n", + "", + errout_str()); + + check("void foo() {\n" // #11200 + " float nf = -1.0;\n" + " if (nf > 1.0) {}\n" + "}\n"); + ASSERT_EQUALS( + "[test.cpp:3]: (style) Condition 'nf>1.0' is always false\n", + errout_str()); + + check("void foo() {\n" // / #13508 + " float nf = -1.0;\n" + " if (nf > -1.0) {}\n" + "}\n"); + TODO_ASSERT_EQUALS( + "[test.cpp:3]: (style) Condition 'nf>-1.0' is always false\n", + "", + errout_str()); } }; diff --git a/test/testother.cpp b/test/testother.cpp index 27a715de81e..f71d93151e4 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -12894,12 +12894,18 @@ class TestOther : public TestFixture { check("void foo() {\n" // #11200 " float f = 1.0;\n" " if (f > 1.0) {}\n" + "}\n"); + ASSERT_EQUALS( + "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'f > 1.0' is always false.\n", + errout_str()); + + check("void foo() {\n" // #13508 + " float f = 1.0;\n" " if (f > -1.0) {}\n" "}\n"); TODO_ASSERT_EQUALS( - "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'f > 1.0' is always false.\n" - "[test.cpp:2] -> [test.cpp:4]: (style) The comparison 'f > -1.0' is always false.\n", - "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'f > 1.0' is always false.\n", + "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'f > -1.0' is always false.\n", + "", errout_str()); check("void foo() {\n" // #13506 @@ -12921,12 +12927,18 @@ class TestOther : public TestFixture { check("void foo() {\n" // #11200 " float pf = +1.0;\n" " if (pf > 1.0) {}\n" + "}\n"); + ASSERT_EQUALS( + "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'pf > 1.0' is always false.\n", + errout_str()); + + check("void foo() {\n" // #13508 + " float pf = +1.0;\n" " if (pf > -1.0) {}\n" "}\n"); TODO_ASSERT_EQUALS( - "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'pf > 1.0' is always false.\n" - "[test.cpp:2] -> [test.cpp:4]: (style) The comparison 'pf > -1.0' is always false.\n", - "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'pf > 1.0' is always false.\n", + "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'pf > -1.0' is always false.\n", + "", errout_str()); check("void foo() {\n" // #13506 @@ -12947,13 +12959,19 @@ class TestOther : public TestFixture { check("void foo() {\n" // #11200 " float nf = -1.0;\n" - " if (nf > 1.0) {}\n" " if (nf > -1.0) {}\n" "}\n"); + ASSERT_EQUALS( + "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'nf > -1.0' is always false.\n", + errout_str()); + + check("void foo() {\n" // #13508 + " float nf = -1.0;\n" + " if (nf > 1.0) {}\n" + "}\n"); TODO_ASSERT_EQUALS( - "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'nf > 1.0' is always false.\n" - "[test.cpp:2] -> [test.cpp:4]: (style) The comparison 'nf > -1.0' is always false.\n", - "[test.cpp:2] -> [test.cpp:4]: (style) The comparison 'nf > -1.0' is always false.\n", + "[test.cpp:2] -> [test.cpp:3]: (style) The comparison 'nf > 1.0' is always false.\n", + "", errout_str()); check("void foo() {\n" // #13508