* Add test case for #7899 and #7974 * Add test case for ##9256
This commit is contained in:
parent
4d44d0c079
commit
7f9ef8c321
|
@ -3858,6 +3858,14 @@ private:
|
|||
" return foo < bar;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #9256
|
||||
check("bool f() {\n"
|
||||
" bool b = false;\n"
|
||||
" b = true;\n"
|
||||
" return b;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void alwaysTrueSymbolic()
|
||||
|
|
|
@ -147,6 +147,7 @@ private:
|
|||
TEST_CASE(duplicateExpression10); // #9485
|
||||
TEST_CASE(duplicateExpression11); // #8916 (function call)
|
||||
TEST_CASE(duplicateExpression12); // #10026
|
||||
TEST_CASE(duplicateExpression13); // #7899
|
||||
TEST_CASE(duplicateExpressionLoop);
|
||||
TEST_CASE(duplicateValueTernary);
|
||||
TEST_CASE(duplicateExpressionTernary); // #6391
|
||||
|
@ -5451,6 +5452,13 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:4]: (style) Same expression on both sides of '-'.\n", errout.str());
|
||||
}
|
||||
|
||||
void duplicateExpression13() { //#7899
|
||||
check("void f() {\n"
|
||||
" if (sizeof(long) == sizeof(long long)) {}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void duplicateExpressionLoop() {
|
||||
check("void f() {\n"
|
||||
" int a = 1;\n"
|
||||
|
|
|
@ -53,6 +53,7 @@ private:
|
|||
TEST_CASE(unusedMain);
|
||||
TEST_CASE(initializationIsNotAFunction);
|
||||
TEST_CASE(operator1); // #3195
|
||||
TEST_CASE(operator2); // #7974
|
||||
TEST_CASE(returnRef);
|
||||
TEST_CASE(attribute); // #3471 - FP __attribute__(constructor)
|
||||
TEST_CASE(initializer_list);
|
||||
|
@ -327,6 +328,19 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void operator2() { // #7974
|
||||
check("bool operator==(const data_t& a, const data_t& b) {\n"
|
||||
" return (a.fd == b.fd);\n"
|
||||
"}\n"
|
||||
"bool operator==(const event& a, const event& b) {\n"
|
||||
" return ((a.events == b.events) && (a.data == b.data));\n"
|
||||
"}\n"
|
||||
"int main(event a, event b) {\n"
|
||||
" return a == b;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void returnRef() {
|
||||
check("int& foo() {return x;}");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used.\n", errout.str());
|
||||
|
|
Loading…
Reference in New Issue