Add some new testcases for crt.


git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@746 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-crt/testcases/t_float.c b/mingw-w64-crt/testcases/t_float.c
new file mode 100755
index 0000000..d900a61
--- /dev/null
+++ b/mingw-w64-crt/testcases/t_float.c
@@ -0,0 +1,74 @@
+#include <math.h>
+#include <stdio.h>
+
+volatile long double ld1 = 3.51L;
+volatile double ld2 = 3.51;
+volatile float ld3 = 3.51F;
+
+#define ARG1_FCT(NAME) \
+  do {printf (#NAME ": %g %g %g\n", (double) NAME##l (ld1), \
+    (double) NAME (ld2), \
+    (double) NAME##f (ld3)); \
+} while (0)
+
+#define ARG2_FCT(NAME,VAL) \
+  do {printf (#NAME ": %g %g %g\n", (double) NAME##l (ld1, VAL##L), \
+    (double) NAME (ld2, VAL), \
+    (double) NAME##f (ld3, VAL##f)); \
+} while (0)
+
+
+int main()
+{
+  printf ("sizeof(float)=%u, sizeof(double)=%u, sizeof(long double)=%u\n", sizeof (float), sizeof(double), sizeof(long double));
+  printf ("%g %g %g\n", (double) ld1, (double) ld2, (double) ld3);
+
+  ARG1_FCT (sin);
+  ARG1_FCT (cos);
+  ARG1_FCT (tan);
+  ARG1_FCT (sinh);
+  ARG1_FCT (cosh);
+  ARG1_FCT (tanh);
+  ARG1_FCT (asin);
+  ARG1_FCT (acos);
+  ARG1_FCT (atan);
+  ARG2_FCT (atan2, 0.5);
+  ARG1_FCT (exp);
+  ARG2_FCT (pow, 2.0);
+  ARG1_FCT (sqrt);
+  ARG1_FCT (ceil);
+  ARG1_FCT (floor);
+  ARG1_FCT (fabs);
+  // double __cdecl ldexp(double _X,int _Y);
+  // double __cdecl frexp(double _X,int *_Y);
+  // double __cdecl modf(double _X,double *_Y);
+  ARG2_FCT(fmod, 2.5);
+  ARG1_FCT (log1p);
+  ARG1_FCT (log2);
+  ARG1_FCT (logb);
+  ARG1_FCT (tgamma);
+  ARG1_FCT (lgamma);
+  ARG1_FCT (erf);
+  ARG1_FCT (erfc);
+  ARG1_FCT (nearbyint);
+  ARG1_FCT (rint);
+  ARG1_FCT (lrint);
+  ARG1_FCT (llrint);
+  ARG1_FCT (lround);
+  ARG1_FCT (llround);
+
+  ARG1_FCT (log);
+  ARG1_FCT (log10);
+  ARG1_FCT (round);
+  ARG1_FCT (trunc);
+  ARG2_FCT (remainder, 2.0);
+  ARG2_FCT (copysign, -1.0);
+  ARG2_FCT (nexttoward, 0.5);
+  ARG2_FCT (fdim, 0.5);
+  ARG2_FCT (fmax, 0.5);
+  ARG2_FCT (fmin, 0.5);
+  ARG2_FCT (hypot, 1.5);
+  __mingw_printf ("Ld:%lg d:%g f:%g\n", ld1, ld2, (double) ld3);
+
+  return 0;
+}
diff --git a/mingw-w64-crt/testcases/t_nullptrexception.c b/mingw-w64-crt/testcases/t_nullptrexception.c
new file mode 100755
index 0000000..d1ae83c
--- /dev/null
+++ b/mingw-w64-crt/testcases/t_nullptrexception.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+int main()
+{
+  char *p = NULL;
+
+  printf ("Raise uncaught NULL pointer exception...\n");
+  *p = 0;
+  return 0;
+}
+
diff --git a/mingw-w64-crt/testcases/t_setjmp.c b/mingw-w64-crt/testcases/t_setjmp.c
new file mode 100755
index 0000000..ba0cde4
--- /dev/null
+++ b/mingw-w64-crt/testcases/t_setjmp.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <setjmp.h>
+
+jmp_buf buf;
+
+void foo (void)
+{
+  printf ("Call longjmp\n");
+  longjmp (buf, 1);
+}
+
+int main ()
+{
+  if (setjmp (buf))
+    {
+      printf ("Caught\n");
+    }
+  else
+    {
+      foo ();
+      printf ("Never reached.\n");
+    }
+  return 1;
+}
diff --git a/mingw-w64-crt/testcases/t_trycatch.cpp b/mingw-w64-crt/testcases/t_trycatch.cpp
new file mode 100755
index 0000000..96a46ea
--- /dev/null
+++ b/mingw-w64-crt/testcases/t_trycatch.cpp
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+void foo (int d) throw (int)
+{
+  throw (d);
+}
+
+int main()
+{
+  try {
+   foo (10);
+   printf ("Hmm...\n");
+  } catch (int ex)
+  {
+    printf ("catch %d==10\n", ex);
+  }
+  printf ("Done.\n");
+  return 0;
+}
+