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