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