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