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