diff options
| author | hexcoder- <heiko@hexco.de> | 2021-12-10 23:09:07 +0100 |
|---|---|---|
| committer | hexcoder- <heiko@hexco.de> | 2021-12-10 23:09:07 +0100 |
| commit | 0648772967249f0a8a693fc3f2617ab46467c5b0 (patch) | |
| tree | bcd551339b5a5d168cde85227ce822a21fc574ad /test/test-fp_minusZerocases.c | |
| parent | 82f1cf07357f8c735088ac60ebbce7ad2bc51f8a (diff) | |
| download | afl++-0648772967249f0a8a693fc3f2617ab46467c5b0.tar.gz | |
additional test cases for floating point comparison splitting pass
Diffstat (limited to 'test/test-fp_minusZerocases.c')
| -rw-r--r-- | test/test-fp_minusZerocases.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test-fp_minusZerocases.c b/test/test-fp_minusZerocases.c new file mode 100644 index 00000000..00beef2e --- /dev/null +++ b/test/test-fp_minusZerocases.c @@ -0,0 +1,35 @@ +/* test cases for floating point comparison transformations + * compile with -DFLOAT_TYPE=float + * or -DFLOAT_TYPE=double + * or -DFLOAT_TYPE="long double" + */ + +#include <assert.h> +#define _GNU_SOURCE +#include <math.h> /* for NaNs and infinity values */ + +int main() { + + volatile FLOAT_TYPE a, b; + + /* negative zero */ + a = 1.0 / -(1.0 / 0.0); /* negative 0 */ + b = 0.0; /* positive 0 */ + assert(!(a < b)); + assert((a <= b)); + assert(!(a > b)); + assert((a >= b)); + assert(!(a != b)); + assert((a == b)); + + a = 1.0 / -(1.0 / 0.0); /* negative 0 */ + b = 1.0 / -(1.0 / 0.0); /* negative 0 */ + assert(!(a < b)); + assert((a <= b)); + assert(!(a > b)); + assert((a >= b)); + assert(!(a != b)); + assert((a == b)); + +} + |
