Add a small test for fmod math function. git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@1526 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-crt/testcases/t_fmod.c b/mingw-w64-crt/testcases/t_fmod.c new file mode 100644 index 0000000..f1b2401 --- /dev/null +++ b/mingw-w64-crt/testcases/t_fmod.c
@@ -0,0 +1,32 @@ +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +int +main () +{ + int res = 0; + int i; + + for (i = 0; i < 5; i++) + { + double m; + +#define TEST(y) do { \ + m = fmod(1 << i, y); \ + printf ("fmod(%d, "#y") = %.18f\n", 1 << i, m); \ + if (m >= y) \ + { \ + res |= 1; \ + printf ("which is bogus!\n"); \ + } \ + } while (0) + + TEST (0.05); + TEST (0.1); + TEST (0.5); + } + + return res; +} +