1## Copyright 2016-2017 Oliver Heimlich
2##
3## This program is free software; you can redistribute it and/or modify
4## it under the terms of the GNU General Public License as published by
5## the Free Software Foundation; either version 3 of the License, or
6## (at your option) any later version.
7##
8## This program is distributed in the hope that it will be useful,
9## but WITHOUT ANY WARRANTY; without even the implied warranty of
10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11## GNU General Public License for more details.
12##
13## You should have received a copy of the GNU General Public License
14## along with this program; if not, see <http://www.gnu.org/licenses/>.
15
16%!shared testdata
17%! testdata = load (file_in_loadpath ("test/crlibm.mat"));;
18
19%!function verify (fname, rnd, data)
20%!  assert (crlibm_function (fname, rnd, data.input), data.output);
21%!endfunction
22
23%!test verify ("acos", -inf, testdata.acos_rd);
24%!test verify ("acos", +inf, testdata.acos_ru);
25%!test verify ("acos",  0.5, testdata.acos_rn);
26%!test verify ("acos",  0,   testdata.acos_rz);
27
28%!test verify ("asin", -inf, testdata.asin_rd);
29%!test verify ("asin", +inf, testdata.asin_ru);
30%!test verify ("asin",  0.5, testdata.asin_rn);
31%!test verify ("asin",  0,   testdata.asin_rz);
32
33%!test verify ("atan", -inf, testdata.atan_rd);
34%!test verify ("atan", +inf, testdata.atan_ru);
35%!test verify ("atan",  0.5, testdata.atan_rn);
36%!test verify ("atan",  0,   testdata.atan_rz);
37
38%!test verify ("cos", -inf, testdata.cos_rd);
39%!test verify ("cos", +inf, testdata.cos_ru);
40%!test verify ("cos",  0.5, testdata.cos_rn);
41%!test verify ("cos",  0,   testdata.cos_rz);
42
43%!test verify ("cosh", -inf, testdata.cosh_rd);
44%!test verify ("cosh", +inf, testdata.cosh_ru);
45%!test verify ("cosh",  0.5, testdata.cosh_rn);
46%!test verify ("cosh",  0,   testdata.cosh_rz);
47
48%!test verify ("exp", -inf, testdata.exp_rd);
49%!test verify ("exp", +inf, testdata.exp_ru);
50%!test verify ("exp",  0.5, testdata.exp_rn);
51%!test verify ("exp",  0,   testdata.exp_rz);
52
53%!test verify ("expm1", -inf, testdata.expm1_rd);
54%!test verify ("expm1", +inf, testdata.expm1_ru);
55%!test verify ("expm1",  0.5, testdata.expm1_rn);
56%!test verify ("expm1",  0,   testdata.expm1_rz);
57
58%!test verify ("log", -inf, testdata.log_rd);
59%!test verify ("log", +inf, testdata.log_ru);
60%!test verify ("log",  0.5, testdata.log_rn);
61%!test verify ("log",  0,   testdata.log_rz);
62
63%!test verify ("log10", -inf, testdata.log10_rd);
64%!test verify ("log10", +inf, testdata.log10_ru);
65%!test verify ("log10",  0.5, testdata.log10_rn);
66%!test verify ("log10",  0,   testdata.log10_rz);
67
68%!test verify ("log1p", -inf, testdata.log1p_rd);
69%!test verify ("log1p", +inf, testdata.log1p_ru);
70%!test verify ("log1p",  0.5, testdata.log1p_rn);
71%!test verify ("log1p",  0,   testdata.log1p_rz);
72
73%!test verify ("log2", -inf, testdata.log2_rd);
74%!test verify ("log2", +inf, testdata.log2_ru);
75%!test verify ("log2",  0.5, testdata.log2_rn);
76%!test verify ("log2",  0,   testdata.log2_rz);
77
78%!test verify ("sin", -inf, testdata.sin_rd);
79%!test verify ("sin", +inf, testdata.sin_ru);
80%!test verify ("sin",  0.5, testdata.sin_rn);
81%!test verify ("sin",  0,   testdata.sin_rz);
82
83%!test verify ("sinh", -inf, testdata.sinh_rd);
84%!test verify ("sinh", +inf, testdata.sinh_ru);
85%!test verify ("sinh",  0.5, testdata.sinh_rn);
86%!test verify ("sinh",  0,   testdata.sinh_rz);
87
88%!test verify ("tan", -inf, testdata.tan_rd);
89%!test verify ("tan", +inf, testdata.tan_ru);
90%!test verify ("tan",  0.5, testdata.tan_rn);
91%!test verify ("tan",  0,   testdata.tan_rz);
92