a8ff7e21c512eeb71190d55a2682b96b2caf61de
[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 perl -pi -e 's/^\s*$//g' pspp.list
72 diff -b -w pspp.list - <<EOF
73 1.1 DISPLAY.  
74 +--------+-------------------------------------------+--------+
75 |Variable|Description                                |Position|
76 #========#===========================================#========#
77 |CONT    |continents of the world                    |       1|
78 |        |Format: A32                                |        |
79 +--------+-------------------------------------------+--------+
80 |SIZE    |sq km                                      |       2|
81 |        |Format: F8.2                               |        |
82 +--------+-------------------------------------------+--------+
83 |POP     |population                                 |       3|
84 |        |Format: F8.2                               |        |
85 +--------+-------------------------------------------+--------+
86 |COUNT   |number of countries                        |       4|
87 |        |Format: F8.2                               |        |
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 EOF
99 if [ $? -ne 0 ] ; then fail ; fi
100
101
102 pass;