Fix use of "export" to work with traditional shells.
[pspp-builds.git] / tests / command / bignum.sh
1 #!/bin/sh
2
3 # This program tests the use of big numbers
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 STAT_CONFIG_PATH=$top_srcdir/config
14 export STAT_CONFIG_PATH
15
16
17 cleanup()
18 {
19      rm -rf $TEMPDIR
20 }
21
22
23 fail()
24 {
25     echo $activity
26     echo FAILED
27     cleanup;
28     exit 1;
29 }
30
31
32 no_result()
33 {
34     echo $activity
35     echo NO RESULT;
36     cleanup;
37     exit 2;
38 }
39
40 pass()
41 {
42     cleanup;
43     exit 0;
44 }
45
46 mkdir -p $TEMPDIR
47
48 cd $TEMPDIR
49
50 activity="create data file"
51 cat > $TEMPDIR/bignum.data << wizzah
52 0
53 0.1
54 0.5
55 0.8
56 0.9
57 0.999
58 1
59 2
60 3
61 4
62 5
63 12
64 123
65 1234
66 12345
67 123456
68 1234567
69 12345678
70 123456789
71 1234567890
72 19999999999
73 199999999999
74 1234567890123
75 19999999999999
76 199999999999999
77 1234567890123456
78 19999999999999999
79 123456789012345678
80 1999999999999999999
81 12345678901234567890
82 199999999999999999999
83 1234567890123456789012
84 19999999999999999999999
85 123456789012345678901234
86 1999999999999999999999999
87 12345678901234567890123456
88 199999999999999999999999999
89 1234567890123456789012345678
90 19999999999999999999999999999
91 123456789012345678901234567890
92 1999999999999999999999999999999
93 12345678901234567890123456789012
94 199999999999999999999999999999999
95 1234567890123456789012345678901234
96 19999999999999999999999999999999999
97 123456789012345678901234567890123456
98 1999999999999999999999999999999999999
99 12345678901234567890123456789012345678
100 199999999999999999999999999999999999999
101 1234567890123456789012345678901234567890
102 1999999999999999999999999999999999999999
103 1e40
104 1.1e40
105 1.5e40
106 1e41
107 1e50
108 1e100
109 1e150
110 1e200
111 1e250
112 1e300
113 1.79641e308
114 wizzah
115 if [ $? -ne 0 ] ; then no_result ; fi
116
117
118 activity="create program"
119 cat > $TESTFILE <<foobar
120 title 'Test use of big numbers'.
121
122 *** Do the portable output.
123 data list file='$TEMPDIR/bignum.data'/BIGNUM 1-40.
124 list.
125
126 *** Do the nonportable output for fun. 
127 descriptives BIGNUM.
128 foobar
129 if [ $? -ne 0 ] ; then no_result ; fi
130
131 activity="run program"
132 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
133 if [ $? -ne 0 ] ; then no_result ; fi
134
135 # Like the above comments say ...
136 # ... if we get here without crashing, then the test has passed.
137
138 pass;