Skip to content

Commit 3274a00

Browse files
committed
Moved some more tests to testgarbage.cpp
1 parent f82dcc0 commit 3274a00

File tree

5 files changed

+38
-39
lines changed

5 files changed

+38
-39
lines changed

test/testbufferoverrun.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ class TestBufferOverrun : public TestFixture {
296296
TEST_CASE(executionPaths1);
297297
TEST_CASE(executionPaths2);
298298
TEST_CASE(executionPaths3); // no FP for function parameter
299-
TEST_CASE(executionPaths4); // Ticket #2386 - Segmentation fault in the ExecutionPath handling
300299
TEST_CASE(executionPaths5); // Ticket #2920 - False positive when size is unknown
301300
TEST_CASE(executionPaths6); // unknown types
302301

@@ -3899,15 +3898,6 @@ class TestBufferOverrun : public TestFixture {
38993898
ASSERT_EQUALS("", errout.str());
39003899
}
39013900

3902-
void executionPaths4() {
3903-
// Ticket #2386 - Segmentation fault upon strange syntax
3904-
ASSERT_THROW(epcheck("void f() {\n"
3905-
" switch ( x ) {\n"
3906-
" case struct Tree : break;\n"
3907-
" }\n"
3908-
"}"), InternalError);
3909-
}
3910-
39113901
void executionPaths5() {
39123902
// No false positive
39133903
epcheck("class A {\n"

test/testconstructors.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ class TestConstructors : public TestFixture {
178178
TEST_CASE(uninitVarPointer); // ticket #3801
179179
TEST_CASE(uninitConstVar);
180180
TEST_CASE(constructors_crash1); // ticket #5641
181-
TEST_CASE(invalidInitializerList); // ticket #5702
182181
}
183182

184183

@@ -3139,14 +3138,6 @@ class TestConstructors : public TestFixture {
31393138
"};\n");
31403139
ASSERT_EQUALS("", errout.str());
31413140
}
3142-
3143-
void invalidInitializerList() {
3144-
// 5702
3145-
ASSERT_THROW(check("struct R1 {\n"
3146-
" int a;\n"
3147-
" R1 () : a { }\n"
3148-
"};\n"), InternalError);
3149-
}
31503141
};
31513142

31523143
REGISTER_TEST(TestConstructors)

test/testgarbage.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ class TestGarbage : public TestFixture {
6565
TEST_CASE(garbageCode22);
6666
TEST_CASE(garbageCode23);
6767
TEST_CASE(garbageCode24); // Ticket #6361 - crash
68+
TEST_CASE(garbageCode25);
69+
TEST_CASE(garbageCode26);
70+
TEST_CASE(garbageCode27);
71+
TEST_CASE(garbageCode28);
6872

6973
TEST_CASE(garbageValueFlow);
7074
TEST_CASE(garbageSymbolDatabase);
@@ -341,6 +345,40 @@ class TestGarbage : public TestFixture {
341345
"}\n");
342346
}
343347

348+
void garbageCode25() {
349+
// Ticket #2386 - Segmentation fault upon strange syntax
350+
ASSERT_THROW(checkCode("void f() {\n"
351+
" switch ( x ) {\n"
352+
" case struct Tree : break;\n"
353+
" }\n"
354+
"}"), InternalError);
355+
}
356+
357+
void garbageCode26() {
358+
// See tickets #2518 #2555 #4171
359+
ASSERT_THROW(checkCode("void f() {\n"
360+
" switch MAKEWORD(1)\n"
361+
" {\n"
362+
" case 0:\n"
363+
" return;\n"
364+
" }\n"
365+
"}"), InternalError);
366+
}
367+
368+
void garbageCode27() {
369+
ASSERT_THROW(checkCode("int f() {\n"
370+
" return if\n"
371+
"}"), InternalError);
372+
}
373+
374+
void garbageCode28() {
375+
// 5702
376+
ASSERT_THROW(checkCode("struct R1 {\n"
377+
" int a;\n"
378+
" R1 () : a { }\n"
379+
"};\n"), InternalError);
380+
}
381+
344382
void garbageValueFlow() {
345383
// #6089
346384
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"

test/testmemleak.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ class TestMemleakInFunction : public TestFixture {
198198

199199
TEST_CASE(switch2);
200200
TEST_CASE(switch3);
201-
TEST_CASE(switch4); // #2555 - segfault
202201

203202
TEST_CASE(ret5); // Bug 2458436 - return use
204203
TEST_CASE(ret6);
@@ -1417,17 +1416,6 @@ class TestMemleakInFunction : public TestFixture {
14171416
ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: str\n", errout.str());
14181417
}
14191418

1420-
void switch4() {
1421-
// See tickets #2518 #2555 #4171
1422-
ASSERT_THROW(check("void f() {\n"
1423-
" switch MAKEWORD(1)\n"
1424-
" {\n"
1425-
" case 0:\n"
1426-
" return;\n"
1427-
" }\n"
1428-
"}"), InternalError);
1429-
}
1430-
14311419
void ret5() {
14321420
check("static char * f()\n"
14331421
"{\n"

test/testnullpointer.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class TestNullPointer : public TestFixture {
8080
TEST_CASE(nullpointerStdStream);
8181
TEST_CASE(functioncall);
8282
TEST_CASE(functioncalllibrary); // use Library to parse function call
83-
TEST_CASE(crash1);
8483
TEST_CASE(functioncallDefaultArguments);
8584
TEST_CASE(nullpointer_internal_error); // #5080
8685
TEST_CASE(nullpointerFputc); // #5645 FP: Null pointer dereference in fputc argument
@@ -2504,13 +2503,6 @@ class TestNullPointer : public TestFixture {
25042503
TODO_ASSERT_EQUALS("[test.cpp:2]: (warning) Possible null pointer dereference if the default parameter value is used: p\n", "", errout.str());
25052504
}
25062505

2507-
2508-
void crash1() {
2509-
ASSERT_THROW(check("int f() {\n"
2510-
" return if\n"
2511-
"}"), InternalError);
2512-
}
2513-
25142506
void nullpointer_internal_error() { // ticket #5080
25152507
check("struct A { unsigned int size; };\n"
25162508
"struct B { struct A *a; };\n"

0 commit comments

Comments
 (0)