annotate tests/test-hypot.c @ 17288:e1bf1347de53

doc: clarify -Werror * doc/warnings.texi (warnings): -Werror is not always a bad idea; clarify that it's intended for developers, not for ordinary builds, and mention --enable-gcc-warnings as one possible use.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 15 Jan 2013 12:21:42 -0800
parents e542fd46ad6f
children 344018b6e5d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12791
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of hypot() function.
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16574
diff changeset
2 Copyright (C) 2010-2013 Free Software Foundation, Inc.
12791
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 (at your option) any later version.
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2010. */
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <math.h>
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include "signature.h"
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 SIGNATURE_CHECK (hypot, double, (double, double));
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25
16512
81d88046c46b hypot tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
26 #include <float.h>
81d88046c46b hypot tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
27
12791
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 #include "macros.h"
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29
16574
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
30 #undef MIN
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
31 #undef MAX
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
32
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
33 #define DOUBLE double
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
34 #define HUGEVAL HUGE_VAL
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
35 #define L_(literal) literal
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
36 #define MANT_DIG DBL_MANT_DIG
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
37 #define MIN DBL_MIN
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
38 #define MAX DBL_MAX
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
39 #define HYPOT hypot
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
40 #define RANDOM randomd
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
41 #include "test-hypot.h"
12791
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 int
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 main ()
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 {
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 /* A particular value. */
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 x = 0.4;
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 y = 0.6;
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 z = hypot (x, y);
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 ASSERT (z >= 0.7211102550 && z <= 0.7211102551);
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51
16574
4acf461e0a81 hypot* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16512
diff changeset
52 test_function ();
16512
81d88046c46b hypot tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
53
12791
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 return 0;
e9c8696b3410 Tests for module 'hypot'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 }