Skip to content

Commit

Permalink
Add corner cases to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire authored and erikd committed Aug 11, 2019
1 parent a2e6010 commit 9225471
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/float_short_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ static void
float_to_short_test (void)
{
static float fpos [] =
{ 0.95, 0.99, 1.0, 1.01, 1.1, 2.0, 11.1, 111.1, 2222.2, 33333.3
{ 0.95, 0.99, 1.0, 1.01, 1.1, 2.0, 11.1, 111.1, 2222.2, 33333.3,
// Some "almost 1" as corner cases
32767./32768., (32767. + 0.4)/32768., (32767. + 0.5)/32768., (32767. + 0.6)/32768., (32767. + 0.9)/32768.,
} ;
static float fneg [] =
{ -0.95, -0.99, -1.0, -1.01, -1.1, -2.0, -11.1, -111.1, -2222.2, -33333.3
{ -0.95, -0.99, -1.0, -1.01, -1.1, -2.0, -11.1, -111.1, -2222.2, -33333.3,
// Some "almost 1" as corner cases
-32767./32768., -(32767. + 0.4)/32768., -(32767. + 0.5)/32768., -(32767. + 0.6)/32768., -(32767. + 0.9)/32768.,
} ;

static short out [MAX (ARRAY_LEN (fpos), ARRAY_LEN (fneg))] ;
Expand Down

0 comments on commit 9225471

Please sign in to comment.