From 63d2572d0872ca3e6c38025cbc289f43328e064b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 29 Jul 2024 13:19:33 +0200 Subject: [PATCH] logp1f: Add tests. * tests/test-logp1f.c: New file, based on tests/test-log1pf.c. * modules/logp1f-tests: New file. --- ChangeLog | 4 ++++ modules/logp1f-tests | 16 +++++++++++++++ tests/test-logp1f.c | 49 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 modules/logp1f-tests create mode 100644 tests/test-logp1f.c diff --git a/ChangeLog b/ChangeLog index c16b3d27c7..7b2fd5ddf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2024-07-29 Bruno Haible + logp1f: Add tests. + * tests/test-logp1f.c: New file, based on tests/test-log1pf.c. + * modules/logp1f-tests: New file. + logp1f: New module. * lib/math.in.h (logp1f): New declaration. * lib/logp1f.c: New file. diff --git a/modules/logp1f-tests b/modules/logp1f-tests new file mode 100644 index 0000000000..e02fcaf3ea --- /dev/null +++ b/modules/logp1f-tests @@ -0,0 +1,16 @@ +Files: +tests/test-logp1f.c +tests/test-log1p.h +tests/signature.h +tests/macros.h +tests/randomf.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-logp1f +check_PROGRAMS += test-logp1f +test_logp1f_SOURCES = test-logp1f.c randomf.c +test_logp1f_LDADD = $(LDADD) @LOGP1F_LIBM@ diff --git a/tests/test-logp1f.c b/tests/test-logp1f.c new file mode 100644 index 0000000000..0c12ff9d1b --- /dev/null +++ b/tests/test-logp1f.c @@ -0,0 +1,49 @@ +/* Test of logp1f() 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 (logp1f, float, (float)); + +#include + +#include "macros.h" + +#define DOUBLE float +#define HUGEVAL HUGE_VALF +#define L_(literal) literal##f +#define MANT_DIG FLT_MANT_DIG +#define LOG1P logp1f +#define RANDOM randomf +#include "test-log1p.h" + +int +main () +{ + /* A particular value. */ + x = 0.6f; + y = logp1f (x); + ASSERT (y >= 0.4700036f && y <= 0.4700037f); + + test_function (); + + return test_exit_status; +} -- 2.39.5