Tests for module 'fmal'.
authorBruno Haible <bruno@clisp.org>
Sun, 6 Nov 2011 01:33:39 +0000 (02:33 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 6 Nov 2011 01:36:42 +0000 (02:36 +0100)
* modules/fmal-tests: New file.
* tests/test-fmal1.c: New file.
* tests/test-fmal2.c: New file.

ChangeLog
modules/fmal-tests [new file with mode: 0644]
tests/test-fmal1.c [new file with mode: 0644]
tests/test-fmal2.c [new file with mode: 0644]

index 964e6ab..2da6c58 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-11-05  Bruno Haible  <bruno@clisp.org>
 
+       Tests for module 'fmal'.
+       * modules/fmal-tests: New file.
+       * tests/test-fmal1.c: New file.
+       * tests/test-fmal2.c: New file.
+
        New module 'fmal'.
        * lib/math.in.h (fmal): New declaration.
        * lib/fmal.c: New file.
diff --git a/modules/fmal-tests b/modules/fmal-tests
new file mode 100644 (file)
index 0000000..5f04dc4
--- /dev/null
@@ -0,0 +1,24 @@
+Files:
+tests/test-fmal1.c
+tests/test-fma1.h
+tests/test-fmal2.c
+tests/test-fma2.h
+tests/infinity.h
+tests/nan.h
+tests/signature.h
+tests/macros.h
+lib/float+.h
+
+Depends-on:
+float
+fpucw
+isnanl-nolibm
+ldexpl
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fmal1 test-fmal2
+check_PROGRAMS += test-fmal1 test-fmal2
+test_fmal1_LDADD = $(LDADD) @FMAL_LIBM@
+test_fmal2_LDADD = $(LDADD) @FMAL_LIBM@ @LDEXPL_LIBM@
diff --git a/tests/test-fmal1.c b/tests/test-fmal1.c
new file mode 100644 (file)
index 0000000..8f477c4
--- /dev/null
@@ -0,0 +1,52 @@
+/* Test of fmal().
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fmal, long double, (long double, long double, long double));
+
+#include "fpucw.h"
+#include "isnanl-nolibm.h"
+#include "infinity.h"
+#include "nan.h"
+#include "macros.h"
+
+#undef INFINITY
+#undef NAN
+
+#define DOUBLE long double
+#define ISNAN isnanl
+#define INFINITY Infinityl ()
+#define NAN NaNl ()
+#define L_(literal) literal##L
+#include "test-fma1.h"
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  test_function (fmal);
+
+  return 0;
+}
diff --git a/tests/test-fmal2.c b/tests/test-fmal2.c
new file mode 100644 (file)
index 0000000..bdc542b
--- /dev/null
@@ -0,0 +1,52 @@
+/* Test of fmal().
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "fpucw.h"
+#include "float+.h"
+#include "infinity.h"
+#include "macros.h"
+
+#undef INFINITY
+
+#define DOUBLE long double
+#define LDEXP ldexpl
+const int MIN_EXP = LDBL_MIN_EXP; /* for gdb */
+#define MIN_EXP LDBL_MIN_EXP
+const int MAX_EXP = LDBL_MAX_EXP; /* for gdb */
+#define MAX_EXP LDBL_MAX_EXP
+const int MANT_BIT = LDBL_MANT_BIT; /* for gdb */
+#define MANT_BIT LDBL_MANT_BIT
+#define INFINITY Infinityl ()
+#define L_(literal) literal##L
+#include "test-fma2.h"
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  test_function (fmal);
+
+  return 0;
+}