]> Savannah Git Hosting - gnulib.git/commitdiff
logp1l: Add tests.
authorBruno Haible <bruno@clisp.org>
Mon, 29 Jul 2024 11:42:05 +0000 (13:42 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 29 Jul 2024 11:55:38 +0000 (13:55 +0200)
* tests/test-logp1l.c: New file, based on tests/test-log1pl.c.
* modules/logp1l-tests: New file.

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

index 01c967a1942ddd712d8c6e262dfa69f7c8be4353..4edac54052f3dcecf3b88a73fbb144f4f1e6a2de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2024-07-29  Bruno Haible  <bruno@clisp.org>
 
+       logp1l: Add tests.
+       * tests/test-logp1l.c: New file, based on tests/test-log1pl.c.
+       * modules/logp1l-tests: New file.
+
        logp1l: New module.
        * lib/math.in.h (logp1l): New declaration.
        * lib/logp1l.c: New file.
diff --git a/modules/logp1l-tests b/modules/logp1l-tests
new file mode 100644 (file)
index 0000000..562b8c0
--- /dev/null
@@ -0,0 +1,18 @@
+Files:
+tests/test-logp1l.c
+tests/test-log1p.h
+tests/signature.h
+tests/macros.h
+tests/randoml.c
+
+Depends-on:
+fpucw
+float
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-logp1l
+check_PROGRAMS += test-logp1l
+test_logp1l_SOURCES = test-logp1l.c randoml.c
+test_logp1l_LDADD = $(LDADD) @LOGP1L_LIBM@
diff --git a/tests/test-logp1l.c b/tests/test-logp1l.c
new file mode 100644 (file)
index 0000000..b7bf6c9
--- /dev/null
@@ -0,0 +1,54 @@
+/* Test of logp1l() function.
+   Copyright (C) 2010-2024 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 <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (logp1l, long double, (long double));
+
+#include <float.h>
+
+#include "fpucw.h"
+#include "macros.h"
+
+#define DOUBLE long double
+#define HUGEVAL HUGE_VALL
+#define L_(literal) literal##L
+#define MANT_DIG LDBL_MANT_DIG
+#define LOG1P logp1l
+#define RANDOM randoml
+#include "test-log1p.h"
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = logp1l (x);
+  ASSERT (y >= 0.4700036292L && y <= 0.4700036293L);
+
+  test_function ();
+
+  return test_exit_status;
+}