1# Checking the variables.                    -*- 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 variables.]])
23
24AT_SETUP([Check variables.])
25
26AT_DATA([variable.scm],
27[[
28(define f (evaluator-create "1/x"))
29(display (evaluator-get-string f))
30]])
31
32AT_CHECK([matheval.sh variable.scm], [ignore], [(1/x)], [ignore])
33
34AT_DATA([variable.scm],
35[[
36(define f (evaluator-create "_222+5"))
37(display (evaluator-evaluate f 1 '("_222") '(1)))
38]])
39
40AT_CHECK([matheval.sh variable.scm], [ignore], [6.0], [ignore])
41
42AT_DATA([variable.scm],
43[[
44(define f (evaluator-create "a+2*aa+3*aaa^2"))
45(display (evaluator-evaluate f 3 '("a" "aa" "aaa") '(1 2 3)))
46]])
47
48AT_CHECK([matheval.sh variable.scm], [ignore], [32.0], [ignore])
49
50AT_DATA([variable.scm],
51[[
52(define f (evaluator-create "1"))
53(display (evaluator-get-variables f))
54]])
55
56AT_CHECK([matheval.sh variable.scm], [ignore], [()], [ignore])
57
58AT_DATA([variable.scm],
59[[
60(define f (evaluator-create "x"))
61(display (evaluator-get-variables f))
62]])
63
64AT_CHECK([matheval.sh variable.scm], [ignore], [(x)], [ignore])
65
66AT_DATA([variable.scm],
67[[
68(define f (evaluator-create "x+y"))
69(display (evaluator-get-variables f))
70]])
71
72AT_CHECK([matheval.sh variable.scm], [ignore], [(x y)], [ignore])
73
74AT_DATA([variable.scm],
75[[
76(define f (evaluator-create "x*y*z"))
77(display (evaluator-get-variables f))
78]])
79
80AT_CHECK([matheval.sh variable.scm], [ignore], [(x y z)], [ignore])
81
82AT_DATA([variable.scm],
83[[
84(define f (evaluator-create "asin(a141^3)*log(b12)"))
85(define f_prim (evaluator-derivative f "a141"))
86(display (evaluator-get-string f_prim))
87]])
88
89AT_CHECK([matheval.sh variable.scm], [ignore], [((((3*(a141^2))/sqrt((1-((a141^3)^2))))*log(b12))+(asin((a141^3))*(0/b12)))], [ignore])
90
91AT_CLEANUP
92