Tests for module 'fmaf'.
authorBruno Haible <bruno@clisp.org>
Sun, 6 Nov 2011 01:31:24 +0000 (02:31 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 6 Nov 2011 01:36:32 +0000 (02:36 +0100)
* modules/fmaf-tests: New file.
* tests/test-fmaf1.c: New file.
* tests/test-fmaf2.c: New file.

ChangeLog
modules/fmaf-tests [new file with mode: 0644]
tests/test-fmaf1.c [new file with mode: 0644]
tests/test-fmaf2.c [new file with mode: 0644]

index 0897630..90cb475 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-11-05  Bruno Haible  <bruno@clisp.org>
 
+       Tests for module 'fmaf'.
+       * modules/fmaf-tests: New file.
+       * tests/test-fmaf1.c: New file.
+       * tests/test-fmaf2.c: New file.
+
        New module 'fmaf'.
        * lib/math.in.h (fmaf): New declaration.
        * lib/fmaf.c: New file.
diff --git a/modules/fmaf-tests b/modules/fmaf-tests
new file mode 100644 (file)
index 0000000..aa7fd8d
--- /dev/null
@@ -0,0 +1,23 @@
+Files:
+tests/test-fmaf1.c
+tests/test-fma1.h
+tests/test-fmaf2.c
+tests/test-fma2.h
+tests/infinity.h
+tests/nan.h
+tests/signature.h
+tests/macros.h
+lib/float+.h
+
+Depends-on:
+float
+isnanf-nolibm
+ldexpf
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fmaf1 test-fmaf2
+check_PROGRAMS += test-fmaf1 test-fmaf2
+test_fmaf1_LDADD = $(LDADD) @FMAF_LIBM@
+test_fmaf2_LDADD = $(LDADD) @FMAF_LIBM@ @LDEXPF_LIBM@
diff --git a/tests/test-fmaf1.c b/tests/test-fmaf1.c
new file mode 100644 (file)
index 0000000..aaa15c3
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test of fmaf().
+   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 (fmaf, float, (float, float, float));
+
+#include "isnanf-nolibm.h"
+#include "infinity.h"
+#include "nan.h"
+#include "macros.h"
+
+#undef INFINITY
+#undef NAN
+
+#define DOUBLE float
+#define ISNAN isnanf
+#define INFINITY Infinityf ()
+#define NAN NaNf ()
+#define L_(literal) literal##f
+#include "test-fma1.h"
+
+int
+main ()
+{
+  test_function (fmaf);
+
+  return 0;
+}
diff --git a/tests/test-fmaf2.c b/tests/test-fmaf2.c
new file mode 100644 (file)
index 0000000..e2823a9
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test of fmaf().
+   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 "float+.h"
+#include "infinity.h"
+#include "macros.h"
+
+#undef INFINITY
+
+#define DOUBLE float
+#define LDEXP ldexpf
+const int MIN_EXP = FLT_MIN_EXP; /* for gdb */
+#define MIN_EXP FLT_MIN_EXP
+const int MAX_EXP = FLT_MAX_EXP; /* for gdb */
+#define MAX_EXP FLT_MAX_EXP
+const int MANT_BIT = FLT_MANT_BIT; /* for gdb */
+#define MANT_BIT FLT_MANT_BIT
+#define INFINITY Infinityf ()
+#define L_(literal) literal##f
+#include "test-fma2.h"
+
+int
+main ()
+{
+  test_function (fmaf);
+
+  return 0;
+}