Improve test coverage for invalid use of bool parameters
This commit is contained in:
parent
5f2f19a646
commit
5a48ac0c6e
|
@ -432,8 +432,16 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:2]: (error) Invalid memset() argument nr 3. A non-boolean value is required.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:2]: (error) Invalid memset() argument nr 3. A non-boolean value is required.\n", errout.str());
|
||||||
|
|
||||||
check("int f() { strtol(a,b,sizeof(a)!=12); }");
|
check("void boolArgZeroIsInvalidButOneIsValid(int param) {\n"
|
||||||
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid strtol() argument nr 3. The value is 0 or 1 (boolean) but the valid values are '0,2:36'.\n", errout.str());
|
" void* buffer = calloc(param > 0, 10);\n"
|
||||||
|
" free(buffer);\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("[test.cpp:2]: (error) Invalid calloc() argument nr 1. The value is 0 or 1 (boolean) but the valid values are '1:'.\n", errout.str());
|
||||||
|
|
||||||
|
check("void boolArgZeroIsValidButOneIsInvalid(int param) {\n"
|
||||||
|
" strtol(a, b, param > 0);\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("[test.cpp:2]: (error) Invalid strtol() argument nr 3. The value is 0 or 1 (boolean) but the valid values are '0,2:36'.\n", errout.str());
|
||||||
|
|
||||||
check("int f() { strtol(a,b,1); }");
|
check("int f() { strtol(a,b,1); }");
|
||||||
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid strtol() argument nr 3. The value is 1 but the valid values are '0,2:36'.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid strtol() argument nr 3. The value is 1 but the valid values are '0,2:36'.\n", errout.str());
|
||||||
|
|
Loading…
Reference in New Issue