Skip to content

Commit

Permalink
Move CBMC float tests to main regression folder
Browse files Browse the repository at this point in the history
  • Loading branch information
schuessf committed Jan 16, 2023
1 parent 2da9514 commit 19af9de
Show file tree
Hide file tree
Showing 32 changed files with 329 additions and 117 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_error(void);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);



Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_error(void);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);



Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_error(void);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);
int main()
{
unsigned int i, j;
double d;

i=100.0;
d=i;
j=d;
if(!(j==100)) __VERIFIER_error();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_assume(int);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_assume(int);



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);

int main()
{

float fs1=2.0f/6.0f;
float fs2=fs1*6.0f;
if(!((int)fs2==2)) __VERIFIER_error();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_assume(int);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_assume(int);



Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_error(void);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);

void multiply(void)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);

int main (int argc, char **argv) {
float f = 0x1.9e0c22p-101f;
float g = -0x1.3c9014p-50f;
float target = -0x1p-149f;

float result = f * g;

if(!(result == target)) __VERIFIER_error();

return 0;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_error(void);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);

int main(void)
{
float f = -0x1.0p-127f;
double d = -0x1.0p-127;
double fp = (double)f;

if(!(d == fp)) __VERIFIER_error();

return 0;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_error(void);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);
int main()
{

Expand Down
21 changes: 21 additions & 0 deletions trunk/examples/programs/FloatingPoint/regression/c/cbmc_float12_.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);
int main()
{
float f;
double d;
unsigned char x;

d=f;

if(f==x)
if(!(d==x)) __VERIFIER_error();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_error(void);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);

const float plus_infinity = 1.0f/0.0f;
const float minus_infinity = 0.0f/-0.0f;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/





Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_error(void);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);



Expand Down
27 changes: 27 additions & 0 deletions trunk/examples/programs/FloatingPoint/regression/c/cbmc_float1_.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);
int main() {
double x;
int y;

x=2;
x-=0.6;
y=x;

if(!(y==1)) __VERIFIER_error();

x=2;
x-=0.4;
y=x;


if(!(y==1)) __VERIFIER_error();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_assume(int);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_assume(int);
extern void __VERIFIER_error(void);
void bug (float min) {
__VERIFIER_assume(min == 0x1.fffffep-105f);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_assume(int);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_assume(int);
extern void __VERIFIER_error(void);
void bug (float min) {
__VERIFIER_assume(min == 0x1.fffffep-105f);
Expand Down
31 changes: 31 additions & 0 deletions trunk/examples/programs/FloatingPoint/regression/c/cbmc_float2_.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_error(void);

int main()
{
float a;
double b;


a=1.25L;
if(!(a==1.25)) __VERIFIER_error();

b=1.250;
if(!(b==1.25)) __VERIFIER_error();


a=0.5e2;
if(!(a==50)) __VERIFIER_error();


a=0x1.4p+4;
if(!(a==20)) __VERIFIER_error();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_assume(int);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_assume(int);



Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
extern void __VERIFIER_assume(int);
//#Safe

/*
* Taken from CBMC's regression test suite
* (http://svn.cprover.org/svn/cbmc/trunk/regression/cbmc/).
*
* The overflow checks were omitted as these require more elaborate assertions.
*/

extern void __VERIFIER_assume(int);



Expand Down
Loading

0 comments on commit 19af9de

Please sign in to comment.