From c32c810ae77576afe2e661d0ada72a360f1ffc2e Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Tue, 30 Apr 2024 14:48:21 +0100 Subject: [PATCH] C++: Add a test with a 'short' type. --- .../library-tests/controlflow/guards/Guards.expected | 3 +++ .../controlflow/guards/GuardsCompare.expected | 4 ++++ .../controlflow/guards/GuardsControl.expected | 3 +++ .../controlflow/guards/GuardsEnsure.expected | 2 ++ cpp/ql/test/library-tests/controlflow/guards/test.c | 12 ++++++++++++ 5 files changed, 24 insertions(+) diff --git a/cpp/ql/test/library-tests/controlflow/guards/Guards.expected b/cpp/ql/test/library-tests/controlflow/guards/Guards.expected index 8ee1b1af7d4..13d6c2b654f 100644 --- a/cpp/ql/test/library-tests/controlflow/guards/Guards.expected +++ b/cpp/ql/test/library-tests/controlflow/guards/Guards.expected @@ -29,6 +29,9 @@ | test.c:152:8:152:8 | p | | test.c:158:8:158:9 | ! ... | | test.c:158:9:158:9 | p | +| test.c:164:8:164:8 | s | +| test.c:170:8:170:9 | ! ... | +| test.c:170:9:170:9 | s | | 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/GuardsCompare.expected b/cpp/ql/test/library-tests/controlflow/guards/GuardsCompare.expected index bdee2bad310..a2f418b3d7b 100644 --- a/cpp/ql/test/library-tests/controlflow/guards/GuardsCompare.expected +++ b/cpp/ql/test/library-tests/controlflow/guards/GuardsCompare.expected @@ -165,3 +165,7 @@ | 152 | p == 0 when p is false | | 158 | ! ... != 0 when ! ... is true | | 158 | ! ... == 0 when ! ... is false | +| 164 | s != 0 when s is true | +| 164 | s == 0 when s is false | +| 170 | ! ... != 0 when ! ... is true | +| 170 | ! ... == 0 when ! ... is false | diff --git a/cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected index 5c024bebc62..cf36a58a515 100644 --- a/cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected +++ b/cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected @@ -82,6 +82,9 @@ | 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.c:164:8:164:8 | s | true | 164 | 166 | +| test.c:170:8:170:9 | ! ... | true | 170 | 172 | +| test.c:170:9:170:9 | s | false | 170 | 172 | | 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/GuardsEnsure.expected b/cpp/ql/test/library-tests/controlflow/guards/GuardsEnsure.expected index 4abf0e6fa82..45d63f6dd53 100644 --- a/cpp/ql/test/library-tests/controlflow/guards/GuardsEnsure.expected +++ b/cpp/ql/test/library-tests/controlflow/guards/GuardsEnsure.expected @@ -247,6 +247,8 @@ unary | test.c:146:7:146:8 | ! ... | test.c:146:7:146:8 | ! ... | != | 0 | 146 | 147 | | test.c:152:8:152:8 | p | test.c:152:8:152:8 | p | != | 0 | 152 | 154 | | test.c:158:8:158:9 | ! ... | test.c:158:8:158:9 | ! ... | != | 0 | 158 | 160 | +| test.c:164:8:164:8 | s | test.c:164:8:164:8 | s | != | 0 | 164 | 166 | +| test.c:170:8:170:9 | ! ... | test.c:170:8:170:9 | ! ... | != | 0 | 170 | 172 | | test.cpp:18:8:18:10 | call to get | test.cpp:18:8:18:10 | call to get | != | 0 | 19 | 19 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | -1 | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | -1 | 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 1d1134d64ed..207e23baa0e 100644 --- a/cpp/ql/test/library-tests/controlflow/guards/test.c +++ b/cpp/ql/test/library-tests/controlflow/guards/test.c @@ -157,5 +157,17 @@ void test6(char* p) { void test7(char* p) { if(!p) { + } +} + +void test8(short s) { + if(s) { + + } +} + +void test9(short s) { + if(!s) { + } } \ No newline at end of file