annotate tests/test-yn.c @ 40057:b06060465f09

maint: Run 'make update-copyright'
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 01 Jan 2019 00:25:11 +0100
parents 10eb9086bea0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12813
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of yn() function.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 Copyright (C) 2010-2019 Free Software Foundation, Inc.
12813
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 (at your option) any later version.
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
12813
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2010. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <math.h>
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include "signature.h"
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 SIGNATURE_CHECK (yn, double, (int, double));
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #include "macros.h"
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 volatile double x;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 double y;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 int
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 main ()
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 {
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 y = yn (0, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 ASSERT (y >= 0.0645032466 && y <= 0.0645032467);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 y = yn (1, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 ASSERT (y >= 0.4141146893 && y <= 0.4141146894);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 y = yn (2, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 ASSERT (y >= 0.1534518529 && y <= 0.1534518530);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 y = yn (3, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 ASSERT (y >= -0.2525864231 && y <= -0.2525864230);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 y = yn (4, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 ASSERT (y >= -0.5522725209 && y <= -0.5522725208);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 y = yn (5, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 ASSERT (y >= -0.9100925684 && y <= -0.9100925683);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 y = yn (6, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 ASSERT (y >= -1.842707923 && y <= -1.842707922);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 y = yn (7, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 ASSERT (y >= -4.908985081 && y <= -4.908985080);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 y = yn (8, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 ASSERT (y >= -16.24302659 && y <= -16.24302658);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 y = yn (9, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 ASSERT (y >= -63.48270581 && y <= -63.48270580);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84 /* A particular value. */
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 x = 3.8;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 y = yn (10, x);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 ASSERT (y >= -284.4645273 && y <= -284.4645272);
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 return 0;
83dd91128293 Tests for module 'yn'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 }