1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2026-10-24 00:48:56 +03:00
Files
gnulib/tests/test-cosh.c
Bruno Haible 64e78e4467 tests: Use streq, part 1.
Done through sed -e 's/strcmp \([(][^()]*[)]\) == 0/streq \1/'

* tests/**/*.[hc]: Use streq instead of strcmp ... == 0.
* modules/*-tests (Dependencies): Add streq.
2026-03-01 09:44:40 +01:00

53 lines
1.3 KiB
C

/* Test of cosh() function.
Copyright (C) 2010-2026 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 (cosh, double, (double));
#include <stdio.h>
#include <string.h>
#include "macros.h"
volatile double x;
double y;
int
main ()
{
/* A particular value. */
x = 0.6;
y = cosh (x);
ASSERT (y >= 1.185465218 && y <= 1.185465219);
/* Another particular value. */
{
char buf[80];
x = 5.152911276257581641;
y = cosh (x);
sprintf (buf, "%.2f", y);
ASSERT (streq (buf, "86.47"));
}
return test_exit_status;
}