Skip to content

Commit a271354

Browse files
committed
C++: Add tests.
1 parent caa935d commit a271354

File tree

8 files changed

+398
-1
lines changed

8 files changed

+398
-1
lines changed

cpp/ql/test/library-tests/controlflow/guards/Guards.expected

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
| test.c:198:8:198:8 | b |
4545
| test.c:206:7:206:8 | ! ... |
4646
| test.c:206:8:206:8 | c |
47+
| test.c:215:6:215:18 | call to __builtin_expect |
48+
| test.c:219:9:219:22 | call to __builtin_expect |
4749
| test.cpp:18:8:18:10 | call to get |
4850
| test.cpp:31:7:31:13 | ... == ... |
4951
| test.cpp:42:13:42:20 | call to getABool |
@@ -92,3 +94,15 @@
9294
| test.cpp:241:9:241:43 | ... && ... |
9395
| test.cpp:241:22:241:30 | ... == ... |
9496
| test.cpp:241:35:241:43 | ... == ... |
97+
| test.cpp:247:6:247:18 | ... == ... |
98+
| test.cpp:253:6:253:18 | ... != ... |
99+
| test.cpp:260:6:260:18 | ... == ... |
100+
| test.cpp:266:6:266:18 | ... != ... |
101+
| test.cpp:273:6:273:17 | ... == ... |
102+
| test.cpp:279:6:279:17 | ... != ... |
103+
| test.cpp:287:6:287:19 | ... == ... |
104+
| test.cpp:293:6:293:19 | ... != ... |
105+
| test.cpp:300:6:300:19 | ... == ... |
106+
| test.cpp:306:6:306:19 | ... != ... |
107+
| test.cpp:312:6:312:18 | ... == ... |
108+
| test.cpp:318:6:318:18 | ... != ... |

cpp/ql/test/library-tests/controlflow/guards/GuardsCompare.expected

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,14 @@
356356
| test.c:206:8:206:8 | c | ! ... == 1 when c is false |
357357
| test.c:206:8:206:8 | c | c != 0 when c is true |
358358
| test.c:206:8:206:8 | c | c == 0 when c is false |
359+
| test.c:215:6:215:18 | call to __builtin_expect | call to __builtin_expect != 0 when call to __builtin_expect is true |
360+
| test.c:215:6:215:18 | call to __builtin_expect | call to __builtin_expect != 1 when call to __builtin_expect is false |
361+
| test.c:215:6:215:18 | call to __builtin_expect | call to __builtin_expect == 0 when call to __builtin_expect is false |
362+
| test.c:215:6:215:18 | call to __builtin_expect | call to __builtin_expect == 1 when call to __builtin_expect is true |
363+
| test.c:219:9:219:22 | call to __builtin_expect | call to __builtin_expect != 0 when call to __builtin_expect is true |
364+
| test.c:219:9:219:22 | call to __builtin_expect | call to __builtin_expect != 1 when call to __builtin_expect is false |
365+
| test.c:219:9:219:22 | call to __builtin_expect | call to __builtin_expect == 0 when call to __builtin_expect is false |
366+
| test.c:219:9:219:22 | call to __builtin_expect | call to __builtin_expect == 1 when call to __builtin_expect is true |
359367
| test.cpp:18:8:18:10 | call to get | call to get != 0 when call to get is true |
360368
| test.cpp:18:8:18:10 | call to get | call to get != 1 when call to get is false |
361369
| test.cpp:18:8:18:10 | call to get | call to get == 0 when call to get is false |
@@ -803,3 +811,119 @@
803811
| test.cpp:241:35:241:43 | ... == ... | i != 0+0 when ... == ... is false |
804812
| test.cpp:241:35:241:43 | ... == ... | i == 0 when ... == ... is true |
805813
| test.cpp:241:35:241:43 | ... == ... | i == 0+0 when ... == ... is true |
814+
| test.cpp:247:6:247:18 | ... == ... | 0 != ... == ...+0 when ... == ... is false |
815+
| test.cpp:247:6:247:18 | ... == ... | 0 == ... == ...+0 when ... == ... is true |
816+
| test.cpp:247:6:247:18 | ... == ... | ... == ... != 0 when ... == ... is false |
817+
| test.cpp:247:6:247:18 | ... == ... | ... == ... != 0 when ... == ... is true |
818+
| test.cpp:247:6:247:18 | ... == ... | ... == ... != 0+0 when ... == ... is false |
819+
| test.cpp:247:6:247:18 | ... == ... | ... == ... != 1 when ... == ... is false |
820+
| test.cpp:247:6:247:18 | ... == ... | ... == ... == 0 when ... == ... is false |
821+
| test.cpp:247:6:247:18 | ... == ... | ... == ... == 0 when ... == ... is true |
822+
| test.cpp:247:6:247:18 | ... == ... | ... == ... == 0+0 when ... == ... is true |
823+
| test.cpp:247:6:247:18 | ... == ... | ... == ... == 1 when ... == ... is true |
824+
| test.cpp:253:6:253:18 | ... != ... | 0 != ... == ...+0 when ... != ... is true |
825+
| test.cpp:253:6:253:18 | ... != ... | 0 == ... == ...+0 when ... != ... is false |
826+
| test.cpp:253:6:253:18 | ... != ... | ... != ... != 0 when ... != ... is true |
827+
| test.cpp:253:6:253:18 | ... != ... | ... != ... != 1 when ... != ... is false |
828+
| test.cpp:253:6:253:18 | ... != ... | ... != ... == 0 when ... != ... is false |
829+
| test.cpp:253:6:253:18 | ... != ... | ... != ... == 1 when ... != ... is true |
830+
| test.cpp:253:6:253:18 | ... != ... | ... == ... != 0 when ... != ... is true |
831+
| test.cpp:253:6:253:18 | ... != ... | ... == ... != 0+0 when ... != ... is true |
832+
| test.cpp:253:6:253:18 | ... != ... | ... == ... == 0 when ... != ... is false |
833+
| test.cpp:253:6:253:18 | ... != ... | ... == ... == 0+0 when ... != ... is false |
834+
| test.cpp:260:6:260:18 | ... == ... | 0 != ... != ...+0 when ... == ... is false |
835+
| test.cpp:260:6:260:18 | ... == ... | 0 == ... != ...+0 when ... == ... is true |
836+
| test.cpp:260:6:260:18 | ... == ... | ... != ... != 0 when ... == ... is false |
837+
| test.cpp:260:6:260:18 | ... == ... | ... != ... != 0+0 when ... == ... is false |
838+
| test.cpp:260:6:260:18 | ... == ... | ... != ... == 0 when ... == ... is true |
839+
| test.cpp:260:6:260:18 | ... == ... | ... != ... == 0+0 when ... == ... is true |
840+
| test.cpp:260:6:260:18 | ... == ... | ... == ... != 0 when ... == ... is true |
841+
| test.cpp:260:6:260:18 | ... == ... | ... == ... != 1 when ... == ... is false |
842+
| test.cpp:260:6:260:18 | ... == ... | ... == ... == 0 when ... == ... is false |
843+
| test.cpp:260:6:260:18 | ... == ... | ... == ... == 1 when ... == ... is true |
844+
| test.cpp:266:6:266:18 | ... != ... | 0 != ... != ...+0 when ... != ... is true |
845+
| test.cpp:266:6:266:18 | ... != ... | 0 == ... != ...+0 when ... != ... is false |
846+
| test.cpp:266:6:266:18 | ... != ... | ... != ... != 0 when ... != ... is true |
847+
| test.cpp:266:6:266:18 | ... != ... | ... != ... != 0+0 when ... != ... is true |
848+
| test.cpp:266:6:266:18 | ... != ... | ... != ... != 1 when ... != ... is false |
849+
| test.cpp:266:6:266:18 | ... != ... | ... != ... == 0 when ... != ... is false |
850+
| test.cpp:266:6:266:18 | ... != ... | ... != ... == 0+0 when ... != ... is false |
851+
| test.cpp:266:6:266:18 | ... != ... | ... != ... == 1 when ... != ... is true |
852+
| test.cpp:273:6:273:17 | ... == ... | 0 != ... < ...+0 when ... == ... is false |
853+
| test.cpp:273:6:273:17 | ... == ... | 0 == ... < ...+0 when ... == ... is true |
854+
| test.cpp:273:6:273:17 | ... == ... | ... < ... != 0 when ... == ... is false |
855+
| test.cpp:273:6:273:17 | ... == ... | ... < ... != 0+0 when ... == ... is false |
856+
| test.cpp:273:6:273:17 | ... == ... | ... < ... == 0 when ... == ... is true |
857+
| test.cpp:273:6:273:17 | ... == ... | ... < ... == 0+0 when ... == ... is true |
858+
| test.cpp:273:6:273:17 | ... == ... | ... == ... != 0 when ... == ... is true |
859+
| test.cpp:273:6:273:17 | ... == ... | ... == ... != 1 when ... == ... is false |
860+
| test.cpp:273:6:273:17 | ... == ... | ... == ... == 0 when ... == ... is false |
861+
| test.cpp:273:6:273:17 | ... == ... | ... == ... == 1 when ... == ... is true |
862+
| test.cpp:279:6:279:17 | ... != ... | 0 != ... < ...+0 when ... != ... is true |
863+
| test.cpp:279:6:279:17 | ... != ... | 0 == ... < ...+0 when ... != ... is false |
864+
| test.cpp:279:6:279:17 | ... != ... | ... != ... != 0 when ... != ... is true |
865+
| test.cpp:279:6:279:17 | ... != ... | ... != ... != 1 when ... != ... is false |
866+
| test.cpp:279:6:279:17 | ... != ... | ... != ... == 0 when ... != ... is false |
867+
| test.cpp:279:6:279:17 | ... != ... | ... != ... == 1 when ... != ... is true |
868+
| test.cpp:279:6:279:17 | ... != ... | ... < ... != 0 when ... != ... is true |
869+
| test.cpp:279:6:279:17 | ... != ... | ... < ... != 0+0 when ... != ... is true |
870+
| test.cpp:279:6:279:17 | ... != ... | ... < ... == 0 when ... != ... is false |
871+
| test.cpp:279:6:279:17 | ... != ... | ... < ... == 0+0 when ... != ... is false |
872+
| test.cpp:287:6:287:19 | ... == ... | 0 != ... == ...+0 when ... == ... is false |
873+
| test.cpp:287:6:287:19 | ... == ... | 0 == ... == ...+0 when ... == ... is true |
874+
| test.cpp:287:6:287:19 | ... == ... | ... == ... != 0 when ... == ... is false |
875+
| test.cpp:287:6:287:19 | ... == ... | ... == ... != 0 when ... == ... is true |
876+
| test.cpp:287:6:287:19 | ... == ... | ... == ... != 0+0 when ... == ... is false |
877+
| test.cpp:287:6:287:19 | ... == ... | ... == ... != 1 when ... == ... is false |
878+
| test.cpp:287:6:287:19 | ... == ... | ... == ... == 0 when ... == ... is false |
879+
| test.cpp:287:6:287:19 | ... == ... | ... == ... == 0 when ... == ... is true |
880+
| test.cpp:287:6:287:19 | ... == ... | ... == ... == 0+0 when ... == ... is true |
881+
| test.cpp:287:6:287:19 | ... == ... | ... == ... == 1 when ... == ... is true |
882+
| test.cpp:293:6:293:19 | ... != ... | 0 != ... == ...+0 when ... != ... is true |
883+
| test.cpp:293:6:293:19 | ... != ... | 0 == ... == ...+0 when ... != ... is false |
884+
| test.cpp:293:6:293:19 | ... != ... | ... != ... != 0 when ... != ... is true |
885+
| test.cpp:293:6:293:19 | ... != ... | ... != ... != 1 when ... != ... is false |
886+
| test.cpp:293:6:293:19 | ... != ... | ... != ... == 0 when ... != ... is false |
887+
| test.cpp:293:6:293:19 | ... != ... | ... != ... == 1 when ... != ... is true |
888+
| test.cpp:293:6:293:19 | ... != ... | ... == ... != 0 when ... != ... is true |
889+
| test.cpp:293:6:293:19 | ... != ... | ... == ... != 0+0 when ... != ... is true |
890+
| test.cpp:293:6:293:19 | ... != ... | ... == ... == 0 when ... != ... is false |
891+
| test.cpp:293:6:293:19 | ... != ... | ... == ... == 0+0 when ... != ... is false |
892+
| test.cpp:300:6:300:19 | ... == ... | 0 != ... != ...+0 when ... == ... is false |
893+
| test.cpp:300:6:300:19 | ... == ... | 0 == ... != ...+0 when ... == ... is true |
894+
| test.cpp:300:6:300:19 | ... == ... | ... != ... != 0 when ... == ... is false |
895+
| test.cpp:300:6:300:19 | ... == ... | ... != ... != 0+0 when ... == ... is false |
896+
| test.cpp:300:6:300:19 | ... == ... | ... != ... == 0 when ... == ... is true |
897+
| test.cpp:300:6:300:19 | ... == ... | ... != ... == 0+0 when ... == ... is true |
898+
| test.cpp:300:6:300:19 | ... == ... | ... == ... != 0 when ... == ... is true |
899+
| test.cpp:300:6:300:19 | ... == ... | ... == ... != 1 when ... == ... is false |
900+
| test.cpp:300:6:300:19 | ... == ... | ... == ... == 0 when ... == ... is false |
901+
| test.cpp:300:6:300:19 | ... == ... | ... == ... == 1 when ... == ... is true |
902+
| test.cpp:306:6:306:19 | ... != ... | 0 != ... != ...+0 when ... != ... is true |
903+
| test.cpp:306:6:306:19 | ... != ... | 0 == ... != ...+0 when ... != ... is false |
904+
| test.cpp:306:6:306:19 | ... != ... | ... != ... != 0 when ... != ... is true |
905+
| test.cpp:306:6:306:19 | ... != ... | ... != ... != 0+0 when ... != ... is true |
906+
| test.cpp:306:6:306:19 | ... != ... | ... != ... != 1 when ... != ... is false |
907+
| test.cpp:306:6:306:19 | ... != ... | ... != ... == 0 when ... != ... is false |
908+
| test.cpp:306:6:306:19 | ... != ... | ... != ... == 0+0 when ... != ... is false |
909+
| test.cpp:306:6:306:19 | ... != ... | ... != ... == 1 when ... != ... is true |
910+
| test.cpp:312:6:312:18 | ... == ... | 0 != ... < ...+0 when ... == ... is false |
911+
| test.cpp:312:6:312:18 | ... == ... | 0 == ... < ...+0 when ... == ... is true |
912+
| test.cpp:312:6:312:18 | ... == ... | ... < ... != 0 when ... == ... is false |
913+
| test.cpp:312:6:312:18 | ... == ... | ... < ... != 0+0 when ... == ... is false |
914+
| test.cpp:312:6:312:18 | ... == ... | ... < ... == 0 when ... == ... is true |
915+
| test.cpp:312:6:312:18 | ... == ... | ... < ... == 0+0 when ... == ... is true |
916+
| test.cpp:312:6:312:18 | ... == ... | ... == ... != 0 when ... == ... is true |
917+
| test.cpp:312:6:312:18 | ... == ... | ... == ... != 1 when ... == ... is false |
918+
| test.cpp:312:6:312:18 | ... == ... | ... == ... == 0 when ... == ... is false |
919+
| test.cpp:312:6:312:18 | ... == ... | ... == ... == 1 when ... == ... is true |
920+
| test.cpp:318:6:318:18 | ... != ... | 0 != ... < ...+0 when ... != ... is true |
921+
| test.cpp:318:6:318:18 | ... != ... | 0 == ... < ...+0 when ... != ... is false |
922+
| test.cpp:318:6:318:18 | ... != ... | ... != ... != 0 when ... != ... is true |
923+
| test.cpp:318:6:318:18 | ... != ... | ... != ... != 1 when ... != ... is false |
924+
| test.cpp:318:6:318:18 | ... != ... | ... != ... == 0 when ... != ... is false |
925+
| test.cpp:318:6:318:18 | ... != ... | ... != ... == 1 when ... != ... is true |
926+
| test.cpp:318:6:318:18 | ... != ... | ... < ... != 0 when ... != ... is true |
927+
| test.cpp:318:6:318:18 | ... != ... | ... < ... != 0+0 when ... != ... is true |
928+
| test.cpp:318:6:318:18 | ... != ... | ... < ... == 0 when ... != ... is false |
929+
| test.cpp:318:6:318:18 | ... != ... | ... < ... == 0+0 when ... != ... is false |

cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@
103103
| test.c:198:8:198:8 | b | false | test.c:198:11:200:3 | { ... } |
104104
| test.c:206:7:206:8 | ! ... | true | test.c:206:11:208:3 | { ... } |
105105
| test.c:206:8:206:8 | c | false | test.c:206:11:208:3 | { ... } |
106+
| test.c:215:6:215:18 | call to __builtin_expect | true | test.c:215:21:217:5 | { ... } |
107+
| test.c:219:9:219:22 | call to __builtin_expect | true | test.c:219:25:221:5 | { ... } |
106108
| test.cpp:18:8:18:10 | call to get | true | test.cpp:19:5:19:14 | ExprStmt |
107109
| test.cpp:31:7:31:13 | ... == ... | false | test.cpp:30:6:30:16 | doSomething |
108110
| test.cpp:31:7:31:13 | ... == ... | false | test.cpp:34:1:34:1 | return ... |
@@ -168,3 +170,27 @@
168170
| test.cpp:241:22:241:30 | ... == ... | true | test.cpp:241:35:241:43 | ms |
169171
| test.cpp:241:22:241:30 | ... == ... | true | test.cpp:241:46:242:13 | { ... } |
170172
| test.cpp:241:35:241:43 | ... == ... | true | test.cpp:241:46:242:13 | { ... } |
173+
| test.cpp:247:6:247:18 | ... == ... | false | test.cpp:249:10:251:3 | { ... } |
174+
| test.cpp:247:6:247:18 | ... == ... | true | test.cpp:247:21:249:3 | { ... } |
175+
| test.cpp:253:6:253:18 | ... != ... | false | test.cpp:255:10:257:3 | { ... } |
176+
| test.cpp:253:6:253:18 | ... != ... | true | test.cpp:253:21:255:3 | { ... } |
177+
| test.cpp:260:6:260:18 | ... == ... | false | test.cpp:262:10:264:3 | { ... } |
178+
| test.cpp:260:6:260:18 | ... == ... | true | test.cpp:260:21:262:3 | { ... } |
179+
| test.cpp:266:6:266:18 | ... != ... | false | test.cpp:268:10:270:3 | { ... } |
180+
| test.cpp:266:6:266:18 | ... != ... | true | test.cpp:266:21:268:3 | { ... } |
181+
| test.cpp:273:6:273:17 | ... == ... | false | test.cpp:275:10:277:3 | { ... } |
182+
| test.cpp:273:6:273:17 | ... == ... | true | test.cpp:273:20:275:3 | { ... } |
183+
| test.cpp:279:6:279:17 | ... != ... | false | test.cpp:281:10:283:3 | { ... } |
184+
| test.cpp:279:6:279:17 | ... != ... | true | test.cpp:279:20:281:3 | { ... } |
185+
| test.cpp:287:6:287:19 | ... == ... | false | test.cpp:289:10:291:3 | { ... } |
186+
| test.cpp:287:6:287:19 | ... == ... | true | test.cpp:287:22:289:3 | { ... } |
187+
| test.cpp:293:6:293:19 | ... != ... | false | test.cpp:295:10:297:3 | { ... } |
188+
| test.cpp:293:6:293:19 | ... != ... | true | test.cpp:293:22:295:3 | { ... } |
189+
| test.cpp:300:6:300:19 | ... == ... | false | test.cpp:302:10:304:3 | { ... } |
190+
| test.cpp:300:6:300:19 | ... == ... | true | test.cpp:300:22:302:3 | { ... } |
191+
| test.cpp:306:6:306:19 | ... != ... | false | test.cpp:308:10:310:3 | { ... } |
192+
| test.cpp:306:6:306:19 | ... != ... | true | test.cpp:306:22:308:3 | { ... } |
193+
| test.cpp:312:6:312:18 | ... == ... | false | test.cpp:314:10:316:3 | { ... } |
194+
| test.cpp:312:6:312:18 | ... == ... | true | test.cpp:312:21:314:3 | { ... } |
195+
| test.cpp:318:6:318:18 | ... != ... | false | test.cpp:320:10:322:3 | { ... } |
196+
| test.cpp:318:6:318:18 | ... != ... | true | test.cpp:318:21:320:3 | { ... } |

0 commit comments

Comments
 (0)