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