From 806d42852ca671c8804058045b84c42969bad98d Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Tue, 30 Apr 2024 11:33:22 +0100 Subject: [PATCH] C++: Add test in C file with pointer type guard. --- .../library-tests/controlflow/guards/Guards.expected | 3 +++ .../controlflow/guards/GuardsControl.expected | 3 +++ cpp/ql/test/library-tests/controlflow/guards/test.c | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/cpp/ql/test/library-tests/controlflow/guards/Guards.expected b/cpp/ql/test/library-tests/controlflow/guards/Guards.expected index 08a8a9281bb..8ee1b1af7d4 100644 --- a/cpp/ql/test/library-tests/controlflow/guards/Guards.expected +++ b/cpp/ql/test/library-tests/controlflow/guards/Guards.expected @@ -26,6 +26,9 @@ | test.c:137:7:137:7 | 0 | | test.c:146:7:146:8 | ! ... | | test.c:146:8:146:8 | x | +| test.c:152:8:152:8 | p | +| test.c:158:8:158:9 | ! ... | +| test.c:158:9:158:9 | p | | test.cpp:18:8:18:10 | call to get | | test.cpp:31:7:31:13 | ... == ... | | test.cpp:42:13:42:20 | call to getABool | diff --git a/cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected index 62d9b0a1229..5c024bebc62 100644 --- a/cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected +++ b/cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected @@ -79,6 +79,9 @@ | test.c:137:7:137:7 | 0 | false | 142 | 136 | | test.c:146:7:146:8 | ! ... | true | 146 | 147 | | test.c:146:8:146:8 | x | false | 146 | 147 | +| test.c:152:8:152:8 | p | true | 152 | 154 | +| test.c:158:8:158:9 | ! ... | true | 158 | 160 | +| test.c:158:9:158:9 | p | false | 158 | 160 | | test.cpp:18:8:18:10 | call to get | true | 19 | 19 | | test.cpp:31:7:31:13 | ... == ... | false | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | diff --git a/cpp/ql/test/library-tests/controlflow/guards/test.c b/cpp/ql/test/library-tests/controlflow/guards/test.c index 186244d4fca..1d1134d64ed 100644 --- a/cpp/ql/test/library-tests/controlflow/guards/test.c +++ b/cpp/ql/test/library-tests/controlflow/guards/test.c @@ -147,3 +147,15 @@ void test5(int x) { test3(); } } + +void test6(char* p) { + if(p) { + + } +} + +void test7(char* p) { + if(!p) { + + } +} \ No newline at end of file