Improve test coverage for functions returning bool values
This commit is contained in:
parent
e712df7cb4
commit
571de5844f
|
@ -597,13 +597,20 @@ private:
|
|||
}
|
||||
|
||||
void checkComparisonOfFuncReturningBool2() {
|
||||
check("void f(){\n"
|
||||
check("void leftOfComparison(){\n"
|
||||
" int temp = 4;\n"
|
||||
" bool a = true;\n"
|
||||
" if(compare(temp) > a){\n"
|
||||
" printf(\"foo\");\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"void rightOfComparison(){\n"
|
||||
" int temp = 4;\n"
|
||||
" bool a = true;\n"
|
||||
" if(a < compare(temp)){\n"
|
||||
" printf(\"foo\");\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"bool compare(int temp){\n"
|
||||
" if(temp==4){\n"
|
||||
" return true;\n"
|
||||
|
@ -611,7 +618,8 @@ private:
|
|||
" else\n"
|
||||
" return false;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (style) Comparison of a function returning boolean value using relational (<, >, <= or >=) operator.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (style) Comparison of a function returning boolean value using relational (<, >, <= or >=) operator.\n"
|
||||
"[test.cpp:11]: (style) Comparison of a function returning boolean value using relational (<, >, <= or >=) operator.\n", errout.str());
|
||||
}
|
||||
|
||||
void checkComparisonOfFuncReturningBool3() {
|
||||
|
|
Loading…
Reference in New Issue