annotate tests/test-modff.c @ 17935:0ad1f4c9eed5 default tip

tests: support stderr verification with returns_() * tests/init.sh (returns_): Disable tracing for this wrapper function, so that stderr of the wrapped command is unchanged, allowing for verification of the contents.
author Pádraig Brady <P@draigBrady.com>
date Mon, 16 Feb 2015 17:20:39 +0000
parents ab58d4870664
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15839
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of modff() function.
17848
ab58d4870664 version-etc: new year
Paul Eggert <eggert@cs.ucla.edu>
parents: 17587
diff changeset
2 Copyright (C) 2010-2015 Free Software Foundation, Inc.
15839
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 (at your option) any later version.
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2010-2011. */
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <math.h>
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include "signature.h"
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 SIGNATURE_CHECK (modff, float, (float, float *));
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25
16562
3f4104450577 modf* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
26 #include <float.h>
3f4104450577 modf* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
27
15839
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 #include "macros.h"
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29
16562
3f4104450577 modf* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
30 #define DOUBLE float
3f4104450577 modf* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
31 #define L_(literal) literal##f
3f4104450577 modf* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
32 #define MANT_DIG FLT_MANT_DIG
3f4104450577 modf* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
33 #define MODF modff
3f4104450577 modf* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
34 #define RANDOM randomf
3f4104450577 modf* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
35 #include "test-modf.h"
15839
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 int
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 main ()
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 {
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 /* A particular positive value. */
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 x = 5.972407f;
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 y = modff (x, &z);
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 ASSERT (y >= 0.972406f && y <= 0.972408f);
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 ASSERT (z == 5.0f);
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 /* A particular negative value. */
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 x = -5.972407f;
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 y = modff (x, &z);
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 ASSERT (y >= -0.972408f && y <= -0.972406f);
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 ASSERT (z == -5.0f);
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51
16562
3f4104450577 modf* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
52 test_function ();
3f4104450577 modf* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
53
15839
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 return 0;
bb3ef01b637c Tests for module 'modff'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 }