From 0dfbd9ecbf8de7aece51da7c6927073c7785375a Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 29 Jul 2024 13:42:05 +0200 Subject: [PATCH] logp1l: Add tests. * tests/test-logp1l.c: New file, based on tests/test-log1pl.c. * modules/logp1l-tests: New file. --- ChangeLog | 4 ++++ modules/logp1l-tests | 18 +++++++++++++++ tests/test-logp1l.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 modules/logp1l-tests create mode 100644 tests/test-logp1l.c diff --git a/ChangeLog b/ChangeLog index 01c967a194..4edac54052 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2024-07-29 Bruno Haible + 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 index 0000000000..562b8c03c0 --- /dev/null +++ b/modules/logp1l-tests @@ -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 index 0000000000..b7bf6c9d7f --- /dev/null +++ b/tests/test-logp1l.c @@ -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 . */ + +/* Written by Bruno Haible , 2010. */ + +#include + +#include + +#include "signature.h" +SIGNATURE_CHECK (logp1l, long double, (long double)); + +#include + +#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; +} -- 2.39.5