Fix missing @clicksequence problem with older Texinfo versions.
[pspp-builds.git] / tests / command / n_of_cases.sh
1 #!/bin/sh
2
3 # This program tests the N OF CASES command to make sure
4 # that it actually works.
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 # ensure that top_srcdir and top_builddir  are absolute
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
12 top_srcdir=`cd $top_srcdir; pwd`
13 top_builddir=`cd $top_builddir; pwd`
14
15 PSPP=$top_builddir/src/ui/terminal/pspp
16
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
19
20 LANG=C
21 export LANG
22
23
24 cleanup()
25 {
26      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
27         echo "NOT cleaning $TEMPDIR"
28         return ; 
29      fi
30      cd /
31      rm -rf $TEMPDIR
32 }
33
34
35 fail()
36 {
37     echo $activity
38     echo FAILED
39     cleanup;
40     exit 1;
41 }
42
43
44 no_result()
45 {
46     echo $activity
47     echo NO RESULT;
48     cleanup;
49     exit 2;
50 }
51
52 pass()
53 {
54     cleanup;
55     exit 0;
56 }
57
58 mkdir -p $TEMPDIR
59
60 cd $TEMPDIR
61
62 cat > $TESTFILE <<EOF
63 INPUT PROGRAM.
64 LOOP #I = 1 TO 100.
65 COMPUTE X=#I.
66 END CASE.
67 END LOOP.
68 END FILE.
69 END INPUT PROGRAM.
70
71 N OF CASES 15.
72
73 LIST.
74 EOF
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77
78 activity="run program"
79 $SUPERVISOR $PSPP --testing-mode $TESTFILE
80 if [ $? -ne 0 ] ; then no_result ; fi
81
82
83 activity="compare output"
84 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
85 diff -b  $TEMPDIR/pspp.list - <<EOF
86        X
87 --------
88     1.00 
89     2.00 
90     3.00 
91     4.00 
92     5.00 
93     6.00 
94     7.00 
95     8.00 
96     9.00 
97    10.00 
98    11.00 
99    12.00 
100    13.00 
101    14.00 
102    15.00 
103 EOF
104 if [ $? -ne 0 ] ; then fail ; fi
105
106
107 pass;