Improve test coverage
This commit is contained in:
parent
f2cf71f6e9
commit
0b97f37736
|
@ -6966,6 +6966,14 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Storing getchar() return value in char variable and then comparing with EOF.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:3]: (warning) Storing getchar() return value in char variable and then comparing with EOF.\n", errout.str());
|
||||||
|
|
||||||
|
check("void f() {\n"
|
||||||
|
" unsigned char c;\n"
|
||||||
|
" while( EOF != ( c = getchar() ) )\n"
|
||||||
|
" {\n"
|
||||||
|
" }\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("[test.cpp:3]: (warning) Storing getchar() return value in char variable and then comparing with EOF.\n", errout.str());
|
||||||
|
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" int i; i = getchar();\n"
|
" int i; i = getchar();\n"
|
||||||
" while( i != EOF)\n"
|
" while( i != EOF)\n"
|
||||||
|
|
|
@ -746,9 +746,11 @@ private:
|
||||||
" void* p = malloc(10);\n"
|
" void* p = malloc(10);\n"
|
||||||
" int* p2 = p + 4;\n"
|
" int* p2 = p + 4;\n"
|
||||||
" int* p3 = p - 1;\n"
|
" int* p3 = p - 1;\n"
|
||||||
|
" int* p4 = 1 + p;\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (portability) 'p' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.\n"
|
ASSERT_EQUALS("[test.cpp:3]: (portability) 'p' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.\n"
|
||||||
"[test.cpp:4]: (portability) 'p' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.\n", errout.str());
|
"[test.cpp:4]: (portability) 'p' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.\n"
|
||||||
|
"[test.cpp:5]: (portability) 'p' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.\n", errout.str());
|
||||||
|
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" void* p1 = malloc(10);\n"
|
" void* p1 = malloc(10);\n"
|
||||||
|
|
Loading…
Reference in New Issue