Removed some duplicate tests and a redundant variable
This commit is contained in:
parent
c11e8cdbfa
commit
9834888f19
|
@ -3304,13 +3304,6 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:6]: (error) Buffer is accessed out of bounds: c\n", errout.str());
|
||||
|
||||
check("void f()\n"
|
||||
"{\n"
|
||||
" char c[6];\n"
|
||||
" strncpy(c,\"hello!\",sizeof(c));\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (warning, inconclusive) The buffer 'c' is not null-terminated after the call to strncpy().\n", errout.str());
|
||||
|
||||
check("void f()\n"
|
||||
"{\n"
|
||||
" char c[6];\n"
|
||||
|
|
|
@ -1462,12 +1462,6 @@ private:
|
|||
// Only report error if base class pointer is deleted that
|
||||
// points at derived class
|
||||
|
||||
checkVirtualDestructor("class Base { public: ~Base(); };\n"
|
||||
"class Derived : public Base { public: ~Derived() { (void)11; } };"
|
||||
"Base *base = new Derived;\n"
|
||||
"delete base;");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (error) Class 'Base' which is inherited by class 'Derived' does not have a virtual destructor.\n", errout.str());
|
||||
|
||||
checkVirtualDestructor("class Base { public: ~Base(); };\n"
|
||||
"class Derived : public Base { public: ~Derived() { (void)11; } };");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
|
|
@ -3254,7 +3254,7 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of a boolean value using relational (<, >, <= or >=) operator.\n", errout.str());
|
||||
|
||||
check("void f(bool x ) {\n"
|
||||
" if ( false >= x )\n"
|
||||
" if ( false <= x )\n"
|
||||
" a++;\n"
|
||||
"}\n"
|
||||
);
|
||||
|
@ -3656,21 +3656,11 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style, inconclusive) Boolean variable 'a' is used in bitwise operation. Did you mean || ?\n", errout.str());
|
||||
|
||||
check("void f(bool a, bool b) {\n"
|
||||
" if(a & b) {}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style, inconclusive) Boolean variable 'a' is used in bitwise operation. Did you mean && ?\n", errout.str());
|
||||
|
||||
check("void f(bool a, bool b) {\n"
|
||||
" if(a & !b) {}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style, inconclusive) Boolean variable 'a' is used in bitwise operation. Did you mean && ?\n", errout.str());
|
||||
|
||||
check("void f(bool a, bool b) {\n"
|
||||
" if(a | b) {}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style, inconclusive) Boolean variable 'a' is used in bitwise operation. Did you mean || ?\n", errout.str());
|
||||
|
||||
check("void f(bool a, bool b) {\n"
|
||||
" if(a | !b) {}\n"
|
||||
"}");
|
||||
|
@ -3710,11 +3700,6 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style, inconclusive) Boolean variable 'b' is used in bitwise operation. Did you mean && ?\n", errout.str());
|
||||
|
||||
check("void f(bool a, bool b) {\n"
|
||||
" if(a & b) {}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style, inconclusive) Boolean variable 'a' is used in bitwise operation. Did you mean && ?\n", errout.str());
|
||||
|
||||
check("void f(int a, int b) {\n"
|
||||
" if(a & b) {}\n"
|
||||
"}");
|
||||
|
|
|
@ -5082,7 +5082,7 @@ private:
|
|||
void simplifyTypedef66() { // ticket #2341
|
||||
const char code[] = "typedef long* GEN;\n"
|
||||
"extern GEN (*foo)(long);";
|
||||
const std::string actual(tok(code));
|
||||
tok(code);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue