Sat Jul 30 21:54:23 2005 Ben Pfaff <blp@gnu.org>
[pspp-builds.git] / tests / command / no_case_size.sh
1 #!/bin/sh
2
3 # This program tests that system files can be read properly, even when the 
4 # case_size header value is -1 (Some 3rd party products do this)
5
6
7 TEMPDIR=/tmp/pspp-tst-$$
8 TESTFILE=$TEMPDIR/`basename $0`.sps
9
10 here=`pwd`;
11
12 # ensure that top_srcdir is absolute
13 cd $top_srcdir; top_srcdir=`pwd`
14
15 STAT_CONFIG_PATH=$top_srcdir/config
16 export STAT_CONFIG_PATH
17
18
19 cleanup()
20 {
21      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
22         echo "NOT cleaning $TEMPDIR"
23         return ; 
24      fi
25      cd /
26      rm -rf $TEMPDIR
27 }
28
29
30 fail()
31 {
32     echo $activity
33     echo FAILED
34     cleanup;
35     exit 1;
36 }
37
38
39 no_result()
40 {
41     echo $activity
42     echo NO RESULT;
43     cleanup;
44     exit 2;
45 }
46
47 pass()
48 {
49     cleanup;
50     exit 0;
51 }
52
53 mkdir -p $TEMPDIR
54
55 cd $TEMPDIR
56
57 activity="create program"
58 cat <<EOF > $TESTFILE
59 GET FILE='$top_srcdir/tests/no_case_size.sav'.
60 DISPLAY DICTIONARY.
61 LIST.
62 EOF
63 if [ $? -ne 0 ] ; then no_result ; fi
64
65
66 activity="run program"
67 $SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE
68 if [ $? -ne 0 ] ; then no_result ; fi
69
70 activity="compare output"
71 diff -b -B -w pspp.list - <<EOF
72 1.1 DISPLAY.  
73 +--------+-------------------------------------------+--------+
74 |Variable|Description                                |Position|
75 #========#===========================================#========#
76 |CONT    |continents of the world                    |       1|
77 |        |Format: A32                                |        |
78 +--------+-------------------------------------------+--------+
79 |SIZE    |sq km                                      |       2|
80 |        |Format: F8.2                               |        |
81 +--------+-------------------------------------------+--------+
82 |POP     |population                                 |       3|
83 |        |Format: F8.2                               |        |
84 +--------+-------------------------------------------+--------+
85 |COUNT   |number of countries                        |       4|
86 |        |Format: F8.2                               |        |
87 +--------+-------------------------------------------+--------+
88
89                             CONT     SIZE      POP    COUNT
90 -------------------------------- -------- -------- --------
91 Asia                             44579000 3.67E+09    44.00 
92 Africa                           30065000 7.78E+08    53.00 
93 North America                    24256000 4.83E+08    23.00 
94 South America                    17819000 3.42E+08    12.00 
95 Antarctica                       13209000      .00      .00 
96 Europe                            9938000 7.32E+08    46.00 
97 Australia/Oceania                 7687000 31000000    14.00 
98
99 EOF
100 if [ $? -ne 0 ] ; then fail ; fi
101
102
103 pass;