1# Checking the constants.                    -*- Autotest -*-
2
3# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012,
4# 2013 Free Software Foundation, Inc.
5#
6# This file is part of GNU libmatheval
7#
8# GNU libmatheval is free software: you can redistribute it and/or
9# modify it under the terms of the GNU General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# GNU libmatheval is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with GNU libmatheval.  If not, see
20# <http://www.gnu.org/licenses/>.
21
22AT_BANNER([[Checking evaluating constants.]])
23
24AT_SETUP([Check constants.])
25
26AT_DATA([constant.scm],
27[[
28(define f (evaluator-create "e"))
29(display (evaluator-evaluate-x f 0))
30]])
31
32AT_CHECK([matheval.sh constant.scm], [ignore], [2.71828182845905], [ignore])
33
34AT_DATA([constant.scm],
35[[
36(define f (evaluator-create "log2e"))
37(display (evaluator-evaluate-x f 0))
38]])
39
40AT_CHECK([matheval.sh constant.scm], [ignore], [1.44269504088896], [ignore])
41
42AT_DATA([constant.scm],
43[[
44(define f (evaluator-create "log10e"))
45(display (evaluator-evaluate-x f 0))
46]])
47
48AT_CHECK([matheval.sh constant.scm], [ignore], [0.434294481903252], [ignore])
49
50AT_DATA([constant.scm],
51[[
52(define f (evaluator-create "ln2"))
53(display (evaluator-evaluate-x f 0))
54]])
55
56AT_CHECK([matheval.sh constant.scm], [ignore], [0.693147180559945], [ignore])
57
58AT_DATA([constant.scm],
59[[
60(define f (evaluator-create "ln10"))
61(display (evaluator-evaluate-x f 0))
62]])
63
64AT_CHECK([matheval.sh constant.scm], [ignore], [2.30258509299405], [ignore])
65
66AT_DATA([constant.scm],
67[[
68(define f (evaluator-create "pi"))
69(display (evaluator-evaluate-x f 0))
70]])
71
72AT_CHECK([matheval.sh constant.scm], [ignore], [3.14159265358979], [ignore])
73
74AT_DATA([constant.scm],
75[[
76(define f (evaluator-create "pi_2"))
77(display (evaluator-evaluate-x f 0))
78]])
79
80AT_CHECK([matheval.sh constant.scm], [ignore], [1.5707963267949], [ignore])
81
82AT_DATA([constant.scm],
83[[
84(define f (evaluator-create "pi_4"))
85(display (evaluator-evaluate-x f 0))
86]])
87
88AT_CHECK([matheval.sh constant.scm], [ignore], [0.785398163397448], [ignore])
89
90AT_DATA([constant.scm],
91[[
92(define f (evaluator-create "1_pi"))
93(display (evaluator-evaluate-x f 0))
94]])
95
96AT_CHECK([matheval.sh constant.scm], [ignore], [0.318309886183791], [ignore])
97
98AT_DATA([constant.scm],
99[[
100(define f (evaluator-create "2_pi"))
101(display (evaluator-evaluate-x f 0))
102]])
103
104AT_CHECK([matheval.sh constant.scm], [ignore], [0.636619772367581], [ignore])
105
106AT_DATA([constant.scm],
107[[
108(define f (evaluator-create "2_sqrtpi"))
109(display (evaluator-evaluate-x f 0))
110]])
111
112AT_CHECK([matheval.sh constant.scm], [ignore], [1.12837916709551], [ignore])
113
114AT_DATA([constant.scm],
115[[
116(define f (evaluator-create "sqrt2"))
117(display (evaluator-evaluate-x f 0))
118]])
119
120AT_CHECK([matheval.sh constant.scm], [ignore], [1.4142135623731], [ignore])
121
122AT_DATA([constant.scm],
123[[
124(define f (evaluator-create "sqrt1_2"))
125(display (evaluator-evaluate-x f 0))
126]])
127
128AT_CHECK([matheval.sh constant.scm], [ignore], [0.707106781186548], [ignore])
129
130AT_DATA([constant.scm],
131[[
132(define f (evaluator-create "e^ln10"))
133(display (evaluator-evaluate-x f 0))
134]])
135
136AT_CHECK([matheval.sh constant.scm], [ignore], [10.0], [ignore])
137
138AT_DATA([constant.scm],
139[[
140(define f (evaluator-create "pi*1_pi"))
141(display (evaluator-evaluate-x f 0))
142]])
143
144AT_CHECK([matheval.sh constant.scm], [ignore], [1.0], [ignore])
145
146AT_DATA([constant.scm],
147[[
148(define f (evaluator-create "sqrt2/sqrt1_2"))
149(display (evaluator-evaluate-x f 0))
150]])
151
152AT_CHECK([matheval.sh constant.scm], [ignore], [2.0], [ignore])
153
154AT_CLEANUP
155