-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from ManuelLerchner/more-regression-tests
Add More regression tests
- Loading branch information
Showing
13 changed files
with
444 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// PARAM: --enable ana.int.bitfield | ||
#include <assert.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#define ANY_ERROR 5 // 0b0101 | ||
|
||
int main() { | ||
int testvar = 235; | ||
|
||
int state; | ||
int r = rand() % 3; | ||
switch (r) { | ||
case 0: | ||
state = 0; /* 0b000 */ | ||
testvar = 1; | ||
break; | ||
case 1: | ||
state = 8; /* 0b1000 */ | ||
testvar = 1; | ||
break; | ||
default: | ||
state = 10; /* 0b1010 */ | ||
testvar = 1; | ||
break; | ||
} | ||
|
||
__goblint_check((state & ANY_ERROR) == 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// PARAM: --disable ana.int.interval --disable ana.int.def_exc --enable ana.int.bitfield | ||
#include <stdlib.h> | ||
|
||
int main() { | ||
int a = 19; | ||
int b = 23; | ||
|
||
__goblint_check(a + b == 42); | ||
__goblint_check(a - b == -4); | ||
__goblint_check(a * b == 437); | ||
__goblint_check(a / b == 0); | ||
__goblint_check(a % b == 19); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// PARAM: --disable ana.int.interval --disable ana.int.def_exc --enable ana.int.bitfield | ||
#include <stdlib.h> | ||
|
||
int main() { | ||
int a; | ||
int b = 23; | ||
|
||
int r = rand() % 2; | ||
switch (r) { | ||
case 0: | ||
a = 19; | ||
printf("a = 19\n"); | ||
break; | ||
default: | ||
a = 17; | ||
printf("a = 17\n"); | ||
break; | ||
} | ||
|
||
// PLUS | ||
|
||
int c_add = a + b; | ||
|
||
if (c_add == 40) { | ||
goblint_check(1); // reachable | ||
} | ||
if (c_add == 42) { | ||
goblint_check(1); // reachable | ||
} | ||
if (c_add > 42 || c_add < 40) { | ||
__goblint_check(0); // NOWARN (unreachable) | ||
} | ||
|
||
// MINUS | ||
|
||
int c_minus = b - a; | ||
|
||
if (c_minus == 6) { | ||
goblint_check(1); // reachable | ||
} | ||
if (c_minus == 4) { | ||
goblint_check(1); // reachable | ||
} | ||
if (c_minus > 6 || c_minus < 4) { | ||
__goblint_check(0); // NOWARN (unreachable) | ||
} | ||
|
||
// MULT | ||
|
||
int c_mult = a * b; | ||
|
||
if (c_mult == 391) { | ||
goblint_check(1); // reachable | ||
} | ||
if (c_mult == 437) { | ||
goblint_check(1); // reachable | ||
} | ||
|
||
// DIV | ||
|
||
// Div on non-unique bitfields is not supported | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// PARAM: --disable ana.int.interval --disable ana.int.def_exc --enable ana.int.bitfield | ||
#include <stdlib.h> | ||
|
||
int main() { | ||
int a = 19; | ||
int b = 14; | ||
|
||
__goblint_check((a & b) == 2); | ||
__goblint_check((a | b) == 31); | ||
__goblint_check((a ^ b) == 29); | ||
__goblint_check((~a) == -20); | ||
__goblint_check((a << 2) == 76); | ||
__goblint_check((a >> 2) == 4); | ||
} |
Oops, something went wrong.