Skip to content

Commit d5b31eb

Browse files
committed
C++: Add more tests.
1 parent d0bd6eb commit d5b31eb

File tree

6 files changed

+272
-0
lines changed

6 files changed

+272
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
| test.c:182:10:182:20 | ... >= ... |
3939
| test.c:182:10:182:33 | ... && ... |
4040
| test.c:182:25:182:33 | ... < ... |
41+
| test.c:190:7:190:8 | ! ... |
42+
| test.c:190:8:190:8 | c |
43+
| test.c:198:7:198:8 | ! ... |
44+
| test.c:198:8:198:8 | b |
45+
| test.c:206:7:206:8 | ! ... |
46+
| test.c:206:8:206:8 | c |
4147
| test.cpp:18:8:18:10 | call to get |
4248
| test.cpp:31:7:31:13 | ... == ... |
4349
| test.cpp:42:13:42:20 | call to getABool |
@@ -57,3 +63,9 @@
5763
| test.cpp:145:6:145:21 | call to __builtin_expect |
5864
| test.cpp:152:7:152:8 | ! ... |
5965
| test.cpp:152:8:152:8 | b |
66+
| test.cpp:160:7:160:8 | ! ... |
67+
| test.cpp:160:8:160:8 | c |
68+
| test.cpp:168:7:168:8 | ! ... |
69+
| test.cpp:168:8:168:8 | b |
70+
| test.cpp:176:7:176:8 | ! ... |
71+
| test.cpp:176:8:176:8 | c |

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

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,78 @@
405405
| 158 | p != 0 when p is true |
406406
| 158 | p == 0 when ! ... is true |
407407
| 158 | p == 0 when p is false |
408+
| 160 | ! ... != 0 when ! ... is true |
409+
| 160 | ! ... != 0 when c is false |
410+
| 160 | ! ... != 1 when ! ... is false |
411+
| 160 | ! ... != 1 when c is true |
412+
| 160 | ! ... == 0 when ! ... is false |
413+
| 160 | ! ... == 0 when c is true |
414+
| 160 | ! ... == 1 when ! ... is true |
415+
| 160 | ! ... == 1 when c is false |
416+
| 160 | ... != ... != 0 when ! ... is false |
417+
| 160 | ... != ... != 0 when c is true |
418+
| 160 | ... != ... != 1 when ! ... is true |
419+
| 160 | ... != ... != 1 when c is false |
420+
| 160 | ... != ... == 0 when ! ... is true |
421+
| 160 | ... != ... == 0 when c is false |
422+
| 160 | ... != ... == 1 when ! ... is false |
423+
| 160 | ... != ... == 1 when c is true |
424+
| 160 | a != b+0 when ! ... is false |
425+
| 160 | a != b+0 when c is true |
426+
| 160 | a == b+0 when ! ... is true |
427+
| 160 | a == b+0 when c is false |
428+
| 160 | b != a+0 when ! ... is false |
429+
| 160 | b != a+0 when c is true |
430+
| 160 | b == a+0 when ! ... is true |
431+
| 160 | b == a+0 when c is false |
432+
| 160 | c != 0 when ! ... is false |
433+
| 160 | c != 0 when c is true |
434+
| 160 | c != 1 when ! ... is true |
435+
| 160 | c != 1 when c is false |
436+
| 160 | c == 0 when ! ... is true |
437+
| 160 | c == 0 when c is false |
438+
| 160 | c == 1 when ! ... is false |
439+
| 160 | c == 1 when c is true |
408440
| 164 | s != 0 when s is true |
409441
| 164 | s != 1 when s is false |
410442
| 164 | s == 0 when s is false |
411443
| 164 | s == 1 when s is true |
444+
| 168 | 10 < a+0 when ! ... is false |
445+
| 168 | 10 < a+0 when b is true |
446+
| 168 | 10 >= a+0 when ! ... is true |
447+
| 168 | 10 >= a+0 when b is false |
448+
| 168 | ! ... != 0 when ! ... is true |
449+
| 168 | ! ... != 0 when b is false |
450+
| 168 | ! ... != 1 when ! ... is false |
451+
| 168 | ! ... != 1 when b is true |
452+
| 168 | ! ... == 0 when ! ... is false |
453+
| 168 | ! ... == 0 when b is true |
454+
| 168 | ! ... == 1 when ! ... is true |
455+
| 168 | ! ... == 1 when b is false |
456+
| 168 | ... > ... != 0 when ! ... is false |
457+
| 168 | ... > ... != 0 when b is true |
458+
| 168 | ... > ... != 1 when ! ... is true |
459+
| 168 | ... > ... != 1 when b is false |
460+
| 168 | ... > ... == 0 when ! ... is true |
461+
| 168 | ... > ... == 0 when b is false |
462+
| 168 | ... > ... == 1 when ! ... is false |
463+
| 168 | ... > ... == 1 when b is true |
464+
| 168 | a < 10+1 when ! ... is true |
465+
| 168 | a < 10+1 when b is false |
466+
| 168 | a < 11 when ! ... is true |
467+
| 168 | a < 11 when b is false |
468+
| 168 | a >= 10+1 when ! ... is false |
469+
| 168 | a >= 10+1 when b is true |
470+
| 168 | a >= 11 when ! ... is false |
471+
| 168 | a >= 11 when b is true |
472+
| 168 | b != 0 when ! ... is false |
473+
| 168 | b != 0 when b is true |
474+
| 168 | b != 1 when ! ... is true |
475+
| 168 | b != 1 when b is false |
476+
| 168 | b == 0 when ! ... is true |
477+
| 168 | b == 0 when b is false |
478+
| 168 | b == 1 when ! ... is false |
479+
| 168 | b == 1 when b is true |
412480
| 170 | ! ... != 0 when ! ... is true |
413481
| 170 | ! ... != 0 when s is false |
414482
| 170 | ! ... != 1 when ! ... is false |
@@ -423,16 +491,44 @@
423491
| 170 | s == 0 when s is false |
424492
| 176 | ! ... != 0 when ! ... is true |
425493
| 176 | ! ... != 0 when ... < ... is false |
494+
| 176 | ! ... != 0 when c is false |
426495
| 176 | ! ... != 1 when ! ... is false |
427496
| 176 | ! ... != 1 when ... < ... is true |
497+
| 176 | ! ... != 1 when c is true |
428498
| 176 | ! ... == 0 when ! ... is false |
429499
| 176 | ! ... == 0 when ... < ... is true |
500+
| 176 | ! ... == 0 when c is true |
430501
| 176 | ! ... == 1 when ! ... is true |
431502
| 176 | ! ... == 1 when ... < ... is false |
503+
| 176 | ! ... == 1 when c is false |
432504
| 176 | ... < ... != 0 when ! ... is false |
433505
| 176 | ... < ... != 0 when ... < ... is true |
434506
| 176 | ... < ... == 0 when ! ... is true |
435507
| 176 | ... < ... == 0 when ... < ... is false |
508+
| 176 | ... > ... != 0 when ! ... is false |
509+
| 176 | ... > ... != 0 when c is true |
510+
| 176 | ... > ... != 1 when ! ... is true |
511+
| 176 | ... > ... != 1 when c is false |
512+
| 176 | ... > ... == 0 when ! ... is true |
513+
| 176 | ... > ... == 0 when c is false |
514+
| 176 | ... > ... == 1 when ! ... is false |
515+
| 176 | ... > ... == 1 when c is true |
516+
| 176 | a < b+1 when ! ... is true |
517+
| 176 | a < b+1 when c is false |
518+
| 176 | a >= b+1 when ! ... is false |
519+
| 176 | a >= b+1 when c is true |
520+
| 176 | b < a+0 when ! ... is false |
521+
| 176 | b < a+0 when c is true |
522+
| 176 | b >= a+0 when ! ... is true |
523+
| 176 | b >= a+0 when c is false |
524+
| 176 | c != 0 when ! ... is false |
525+
| 176 | c != 0 when c is true |
526+
| 176 | c != 1 when ! ... is true |
527+
| 176 | c != 1 when c is false |
528+
| 176 | c == 0 when ! ... is true |
529+
| 176 | c == 0 when c is false |
530+
| 176 | c == 1 when ! ... is false |
531+
| 176 | c == 1 when c is true |
436532
| 182 | 1.0 < foo+1 when ... < ... is false |
437533
| 182 | 1.0 >= foo+1 when ... && ... is true |
438534
| 182 | 1.0 >= foo+1 when ... < ... is true |
@@ -469,3 +565,39 @@
469565
| 182 | foo >= 1.0+0 when ... < ... is false |
470566
| 182 | foo >= 9.999999999999999547e-07+0 when ... && ... is true |
471567
| 182 | foo >= 9.999999999999999547e-07+0 when ... >= ... is true |
568+
| 190 | ! ... != 0 when ! ... is true |
569+
| 190 | ! ... != 0 when c is false |
570+
| 190 | ! ... != 1 when ! ... is false |
571+
| 190 | ! ... != 1 when c is true |
572+
| 190 | ! ... == 0 when ! ... is false |
573+
| 190 | ! ... == 0 when c is true |
574+
| 190 | ! ... == 1 when ! ... is true |
575+
| 190 | ! ... == 1 when c is false |
576+
| 190 | c != 0 when ! ... is false |
577+
| 190 | c != 0 when c is true |
578+
| 190 | c == 0 when ! ... is true |
579+
| 190 | c == 0 when c is false |
580+
| 198 | ! ... != 0 when ! ... is true |
581+
| 198 | ! ... != 0 when b is false |
582+
| 198 | ! ... != 1 when ! ... is false |
583+
| 198 | ! ... != 1 when b is true |
584+
| 198 | ! ... == 0 when ! ... is false |
585+
| 198 | ! ... == 0 when b is true |
586+
| 198 | ! ... == 1 when ! ... is true |
587+
| 198 | ! ... == 1 when b is false |
588+
| 198 | b != 0 when ! ... is false |
589+
| 198 | b != 0 when b is true |
590+
| 198 | b == 0 when ! ... is true |
591+
| 198 | b == 0 when b is false |
592+
| 206 | ! ... != 0 when ! ... is true |
593+
| 206 | ! ... != 0 when c is false |
594+
| 206 | ! ... != 1 when ! ... is false |
595+
| 206 | ! ... != 1 when c is true |
596+
| 206 | ! ... == 0 when ! ... is false |
597+
| 206 | ! ... == 0 when c is true |
598+
| 206 | ! ... == 1 when ! ... is true |
599+
| 206 | ! ... == 1 when c is false |
600+
| 206 | c != 0 when ! ... is false |
601+
| 206 | c != 0 when c is true |
602+
| 206 | c == 0 when ! ... is true |
603+
| 206 | c == 0 when c is false |

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@
9393
| test.c:182:10:182:33 | ... && ... | false | 182 | 184 |
9494
| test.c:182:10:182:33 | ... && ... | true | 181 | 182 |
9595
| test.c:182:25:182:33 | ... < ... | true | 181 | 182 |
96+
| test.c:190:7:190:8 | ! ... | true | 190 | 192 |
97+
| test.c:190:8:190:8 | c | false | 190 | 192 |
98+
| test.c:198:7:198:8 | ! ... | true | 198 | 200 |
99+
| test.c:198:8:198:8 | b | false | 198 | 200 |
100+
| test.c:206:7:206:8 | ! ... | true | 206 | 208 |
101+
| test.c:206:8:206:8 | c | false | 206 | 208 |
96102
| test.cpp:18:8:18:10 | call to get | true | 19 | 19 |
97103
| test.cpp:31:7:31:13 | ... == ... | false | 30 | 30 |
98104
| test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 |
@@ -118,3 +124,9 @@
118124
| test.cpp:145:6:145:21 | call to __builtin_expect | true | 145 | 146 |
119125
| test.cpp:152:7:152:8 | ! ... | true | 152 | 153 |
120126
| test.cpp:152:8:152:8 | b | false | 152 | 153 |
127+
| test.cpp:160:7:160:8 | ! ... | true | 160 | 162 |
128+
| test.cpp:160:8:160:8 | c | false | 160 | 162 |
129+
| test.cpp:168:7:168:8 | ! ... | true | 168 | 170 |
130+
| test.cpp:168:8:168:8 | b | false | 168 | 170 |
131+
| test.cpp:176:7:176:8 | ! ... | true | 176 | 178 |
132+
| test.cpp:176:8:176:8 | c | false | 176 | 178 |

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,18 @@ binary
195195
| test.cpp:152:7:152:8 | ! ... | test.cpp:151:12:151:13 | 10 | < | test.cpp:151:8:151:8 | a | 1 | 152 | 153 |
196196
| test.cpp:152:8:152:8 | b | test.cpp:151:8:151:8 | a | >= | test.cpp:151:12:151:13 | 10 | 0 | 152 | 153 |
197197
| test.cpp:152:8:152:8 | b | test.cpp:151:12:151:13 | 10 | < | test.cpp:151:8:151:8 | a | 1 | 152 | 153 |
198+
| test.cpp:160:7:160:8 | ! ... | test.cpp:158:12:158:12 | a | == | test.cpp:158:17:158:17 | b | 0 | 160 | 162 |
199+
| test.cpp:160:7:160:8 | ! ... | test.cpp:158:17:158:17 | b | == | test.cpp:158:12:158:12 | a | 0 | 160 | 162 |
200+
| test.cpp:160:8:160:8 | c | test.cpp:158:12:158:12 | a | == | test.cpp:158:17:158:17 | b | 0 | 160 | 162 |
201+
| test.cpp:160:8:160:8 | c | test.cpp:158:17:158:17 | b | == | test.cpp:158:12:158:12 | a | 0 | 160 | 162 |
202+
| test.cpp:168:7:168:8 | ! ... | test.cpp:166:12:166:12 | a | < | test.cpp:166:16:166:17 | 10 | 1 | 168 | 170 |
203+
| test.cpp:168:7:168:8 | ! ... | test.cpp:166:16:166:17 | 10 | >= | test.cpp:166:12:166:12 | a | 0 | 168 | 170 |
204+
| test.cpp:168:8:168:8 | b | test.cpp:166:12:166:12 | a | < | test.cpp:166:16:166:17 | 10 | 1 | 168 | 170 |
205+
| test.cpp:168:8:168:8 | b | test.cpp:166:16:166:17 | 10 | >= | test.cpp:166:12:166:12 | a | 0 | 168 | 170 |
206+
| test.cpp:176:7:176:8 | ! ... | test.cpp:174:12:174:12 | a | < | test.cpp:174:16:174:16 | b | 1 | 176 | 178 |
207+
| test.cpp:176:7:176:8 | ! ... | test.cpp:174:16:174:16 | b | >= | test.cpp:174:12:174:12 | a | 0 | 176 | 178 |
208+
| test.cpp:176:8:176:8 | c | test.cpp:174:12:174:12 | a | < | test.cpp:174:16:174:16 | b | 1 | 176 | 178 |
209+
| test.cpp:176:8:176:8 | c | test.cpp:174:16:174:16 | b | >= | test.cpp:174:12:174:12 | a | 0 | 176 | 178 |
198210
unary
199211
| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | < | 1 | 10 | 11 |
200212
| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | >= | 1 | 7 | 9 |
@@ -500,6 +512,24 @@ unary
500512
| test.c:182:10:182:33 | ... && ... | test.c:182:25:182:33 | ... < ... | == | 1 | 181 | 182 |
501513
| test.c:182:25:182:33 | ... < ... | test.c:182:25:182:33 | ... < ... | != | 0 | 181 | 182 |
502514
| test.c:182:25:182:33 | ... < ... | test.c:182:25:182:33 | ... < ... | == | 1 | 181 | 182 |
515+
| test.c:190:7:190:8 | ! ... | test.c:190:7:190:8 | ! ... | != | 0 | 190 | 192 |
516+
| test.c:190:7:190:8 | ! ... | test.c:190:7:190:8 | ! ... | == | 1 | 190 | 192 |
517+
| test.c:190:7:190:8 | ! ... | test.c:190:8:190:8 | c | == | 0 | 190 | 192 |
518+
| test.c:190:8:190:8 | c | test.c:190:7:190:8 | ! ... | != | 0 | 190 | 192 |
519+
| test.c:190:8:190:8 | c | test.c:190:7:190:8 | ! ... | == | 1 | 190 | 192 |
520+
| test.c:190:8:190:8 | c | test.c:190:8:190:8 | c | == | 0 | 190 | 192 |
521+
| test.c:198:7:198:8 | ! ... | test.c:198:7:198:8 | ! ... | != | 0 | 198 | 200 |
522+
| test.c:198:7:198:8 | ! ... | test.c:198:7:198:8 | ! ... | == | 1 | 198 | 200 |
523+
| test.c:198:7:198:8 | ! ... | test.c:198:8:198:8 | b | == | 0 | 198 | 200 |
524+
| test.c:198:8:198:8 | b | test.c:198:7:198:8 | ! ... | != | 0 | 198 | 200 |
525+
| test.c:198:8:198:8 | b | test.c:198:7:198:8 | ! ... | == | 1 | 198 | 200 |
526+
| test.c:198:8:198:8 | b | test.c:198:8:198:8 | b | == | 0 | 198 | 200 |
527+
| test.c:206:7:206:8 | ! ... | test.c:206:7:206:8 | ! ... | != | 0 | 206 | 208 |
528+
| test.c:206:7:206:8 | ! ... | test.c:206:7:206:8 | ! ... | == | 1 | 206 | 208 |
529+
| test.c:206:7:206:8 | ! ... | test.c:206:8:206:8 | c | == | 0 | 206 | 208 |
530+
| test.c:206:8:206:8 | c | test.c:206:7:206:8 | ! ... | != | 0 | 206 | 208 |
531+
| test.c:206:8:206:8 | c | test.c:206:7:206:8 | ! ... | == | 1 | 206 | 208 |
532+
| test.c:206:8:206:8 | c | test.c:206:8:206:8 | c | == | 0 | 206 | 208 |
503533
| test.cpp:18:8:18:10 | call to get | test.cpp:18:8:18:10 | call to get | != | 0 | 19 | 19 |
504534
| test.cpp:18:8:18:10 | call to get | test.cpp:18:8:18:10 | call to get | == | 1 | 19 | 19 |
505535
| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | -1 | 30 | 30 |
@@ -568,3 +598,41 @@ unary
568598
| test.cpp:152:8:152:8 | b | test.cpp:152:7:152:8 | ! ... | == | 1 | 152 | 153 |
569599
| test.cpp:152:8:152:8 | b | test.cpp:152:8:152:8 | b | != | 1 | 152 | 153 |
570600
| test.cpp:152:8:152:8 | b | test.cpp:152:8:152:8 | b | == | 0 | 152 | 153 |
601+
| test.cpp:160:7:160:8 | ! ... | test.cpp:158:12:158:17 | ... != ... | != | 1 | 160 | 162 |
602+
| test.cpp:160:7:160:8 | ! ... | test.cpp:158:12:158:17 | ... != ... | == | 0 | 160 | 162 |
603+
| test.cpp:160:7:160:8 | ! ... | test.cpp:160:7:160:8 | ! ... | != | 0 | 160 | 162 |
604+
| test.cpp:160:7:160:8 | ! ... | test.cpp:160:7:160:8 | ! ... | == | 1 | 160 | 162 |
605+
| test.cpp:160:7:160:8 | ! ... | test.cpp:160:8:160:8 | c | != | 1 | 160 | 162 |
606+
| test.cpp:160:7:160:8 | ! ... | test.cpp:160:8:160:8 | c | == | 0 | 160 | 162 |
607+
| test.cpp:160:8:160:8 | c | test.cpp:158:12:158:17 | ... != ... | != | 1 | 160 | 162 |
608+
| test.cpp:160:8:160:8 | c | test.cpp:158:12:158:17 | ... != ... | == | 0 | 160 | 162 |
609+
| test.cpp:160:8:160:8 | c | test.cpp:160:7:160:8 | ! ... | != | 0 | 160 | 162 |
610+
| test.cpp:160:8:160:8 | c | test.cpp:160:7:160:8 | ! ... | == | 1 | 160 | 162 |
611+
| test.cpp:160:8:160:8 | c | test.cpp:160:8:160:8 | c | != | 1 | 160 | 162 |
612+
| test.cpp:160:8:160:8 | c | test.cpp:160:8:160:8 | c | == | 0 | 160 | 162 |
613+
| test.cpp:168:7:168:8 | ! ... | test.cpp:166:12:166:12 | a | < | 11 | 168 | 170 |
614+
| test.cpp:168:7:168:8 | ! ... | test.cpp:166:12:166:17 | ... > ... | != | 1 | 168 | 170 |
615+
| test.cpp:168:7:168:8 | ! ... | test.cpp:166:12:166:17 | ... > ... | == | 0 | 168 | 170 |
616+
| test.cpp:168:7:168:8 | ! ... | test.cpp:168:7:168:8 | ! ... | != | 0 | 168 | 170 |
617+
| test.cpp:168:7:168:8 | ! ... | test.cpp:168:7:168:8 | ! ... | == | 1 | 168 | 170 |
618+
| test.cpp:168:7:168:8 | ! ... | test.cpp:168:8:168:8 | b | != | 1 | 168 | 170 |
619+
| test.cpp:168:7:168:8 | ! ... | test.cpp:168:8:168:8 | b | == | 0 | 168 | 170 |
620+
| test.cpp:168:8:168:8 | b | test.cpp:166:12:166:12 | a | < | 11 | 168 | 170 |
621+
| test.cpp:168:8:168:8 | b | test.cpp:166:12:166:17 | ... > ... | != | 1 | 168 | 170 |
622+
| test.cpp:168:8:168:8 | b | test.cpp:166:12:166:17 | ... > ... | == | 0 | 168 | 170 |
623+
| test.cpp:168:8:168:8 | b | test.cpp:168:7:168:8 | ! ... | != | 0 | 168 | 170 |
624+
| test.cpp:168:8:168:8 | b | test.cpp:168:7:168:8 | ! ... | == | 1 | 168 | 170 |
625+
| test.cpp:168:8:168:8 | b | test.cpp:168:8:168:8 | b | != | 1 | 168 | 170 |
626+
| test.cpp:168:8:168:8 | b | test.cpp:168:8:168:8 | b | == | 0 | 168 | 170 |
627+
| test.cpp:176:7:176:8 | ! ... | test.cpp:174:12:174:16 | ... > ... | != | 1 | 176 | 178 |
628+
| test.cpp:176:7:176:8 | ! ... | test.cpp:174:12:174:16 | ... > ... | == | 0 | 176 | 178 |
629+
| test.cpp:176:7:176:8 | ! ... | test.cpp:176:7:176:8 | ! ... | != | 0 | 176 | 178 |
630+
| test.cpp:176:7:176:8 | ! ... | test.cpp:176:7:176:8 | ! ... | == | 1 | 176 | 178 |
631+
| test.cpp:176:7:176:8 | ! ... | test.cpp:176:8:176:8 | c | != | 1 | 176 | 178 |
632+
| test.cpp:176:7:176:8 | ! ... | test.cpp:176:8:176:8 | c | == | 0 | 176 | 178 |
633+
| test.cpp:176:8:176:8 | c | test.cpp:174:12:174:16 | ... > ... | != | 1 | 176 | 178 |
634+
| test.cpp:176:8:176:8 | c | test.cpp:174:12:174:16 | ... > ... | == | 0 | 176 | 178 |
635+
| test.cpp:176:8:176:8 | c | test.cpp:176:7:176:8 | ! ... | != | 0 | 176 | 178 |
636+
| test.cpp:176:8:176:8 | c | test.cpp:176:7:176:8 | ! ... | == | 1 | 176 | 178 |
637+
| test.cpp:176:8:176:8 | c | test.cpp:176:8:176:8 | c | != | 1 | 176 | 178 |
638+
| test.cpp:176:8:176:8 | c | test.cpp:176:8:176:8 | c | == | 0 | 176 | 178 |

cpp/ql/test/library-tests/controlflow/guards/test.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,28 @@ void test11(double foo) {
182182
if(!(foo >= 1e-6 && foo < 1.0)) {
183183

184184
}
185+
}
186+
187+
void test12(int a, int b) {
188+
int c = a != b;
189+
190+
if (!c) {
191+
192+
}
193+
}
194+
195+
void test13(int a) {
196+
int b = a > 10;
197+
198+
if (!b) {
199+
200+
}
201+
}
202+
203+
void test14(int a, int b) {
204+
int c = a > b;
205+
206+
if (!c) {
207+
208+
}
185209
}

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,28 @@ void test_with_reference(bool& b, int a) {
152152
if(!b) {
153153
use(a);
154154
}
155+
}
156+
157+
void test_with_negated_binary_equality(int a, int b) {
158+
bool c = a != b;
159+
160+
if (!c) {
161+
162+
}
163+
}
164+
165+
void test_with_negated_unary_relational(int a) {
166+
bool b = a > 10;
167+
168+
if (!b) {
169+
170+
}
171+
}
172+
173+
void test_with_negated_binary_relational(int a, int b) {
174+
bool c = a > b;
175+
176+
if (!c) {
177+
178+
}
155179
}

0 commit comments

Comments
 (0)