testunusedvar: Remove test cases that have undefined behavior
This commit is contained in:
parent
e072c2d786
commit
3c885df74d
|
@ -3582,15 +3582,6 @@ private:
|
||||||
ASSERT_EQUALS(// TODO "[test.cpp:4]: (style) Variable 'a' is assigned a value that is never used.\n"
|
ASSERT_EQUALS(// TODO "[test.cpp:4]: (style) Variable 'a' is assigned a value that is never used.\n"
|
||||||
"[test.cpp:5]: (style) Variable 'c' is assigned a value that is never used.\n", errout.str());
|
"[test.cpp:5]: (style) Variable 'c' is assigned a value that is never used.\n", errout.str());
|
||||||
|
|
||||||
// extracttests.start: int x;
|
|
||||||
functionVariableUsage("void foo()\n"
|
|
||||||
"{\n"
|
|
||||||
" int a[10], * b = a + 10;\n"
|
|
||||||
" int * c = b - 10;\n"
|
|
||||||
" x = c[0];\n"
|
|
||||||
"}");
|
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'a' is not assigned a value.\n", errout.str());
|
|
||||||
|
|
||||||
functionVariableUsage("void foo()\n"
|
functionVariableUsage("void foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" int a[10], * b = a + 10;\n"
|
" int a[10], * b = a + 10;\n"
|
||||||
|
@ -3607,16 +3598,6 @@ private:
|
||||||
"}");
|
"}");
|
||||||
// TODO ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'c[1]' is assigned a value that is never used.\n", errout.str());
|
// TODO ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'c[1]' is assigned a value that is never used.\n", errout.str());
|
||||||
|
|
||||||
// extracttests.start: void f(int);
|
|
||||||
functionVariableUsage("void foo()\n"
|
|
||||||
"{\n"
|
|
||||||
" int a[10], * b = a + 10;\n"
|
|
||||||
" int * c = b - 10;\n"
|
|
||||||
" int d = c[0];\n"
|
|
||||||
" f(d);\n"
|
|
||||||
"}");
|
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'a' is not assigned a value.\n", errout.str());
|
|
||||||
|
|
||||||
functionVariableUsage("void foo() {\n" // #4022 - FP (a is assigned a value that is never used)
|
functionVariableUsage("void foo() {\n" // #4022 - FP (a is assigned a value that is never used)
|
||||||
" int a[2], *b[2];\n"
|
" int a[2], *b[2];\n"
|
||||||
" a[0] = 123;\n"
|
" a[0] = 123;\n"
|
||||||
|
|
Loading…
Reference in New Issue