Only taint casereader if case size is unknown.
[pspp] / tests / command / split-file.sh
1 #!/bin/sh
2
3 # This program tests the split file command
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 LANG=C
21 export LANG
22
23
24 cleanup()
25 {
26      cd /
27      rm -rf $TEMPDIR
28 }
29
30
31 fail()
32 {
33     echo $activity
34     echo FAILED
35     cleanup;
36     exit 1;
37 }
38
39
40 no_result()
41 {
42     echo $activity
43     echo NO RESULT;
44     cleanup;
45     exit 2;
46 }
47
48 pass()
49 {
50     cleanup;
51     exit 0;
52 }
53
54 mkdir -p $TEMPDIR
55
56 cd $TEMPDIR
57
58 activity="create program"
59 cat > $TEMPDIR/split.stat <<EOF
60 title 'Test SPLIT FILE utility'.
61
62 data list notable /X 1 Y 2.
63 begin data.
64 12
65 16
66 17
67 19
68 15
69 14
70 27
71 20
72 26
73 25
74 28
75 29
76 24
77 end data.
78 split file by x.
79 list.
80 EOF
81 if [ $? -ne 0 ] ; then no_result ; fi
82
83 activity="run program"
84 $SUPERVISOR $PSPP -o raw-ascii $TEMPDIR/split.stat
85 if [ $? -ne 0 ] ; then no_result ; fi
86
87 activity="compare results"
88 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
89 diff  -b $TEMPDIR/pspp.list - <<EOF
90 Variable Value Label
91 X            1
92 X Y
93 - -
94 1 2 
95 1 6 
96 1 7 
97 1 9 
98 1 5 
99 1 4 
100 Variable Value Label
101 X            2
102 X Y
103 - -
104 2 7 
105 2 0 
106 2 6 
107 2 5 
108 2 8 
109 2 9 
110 2 4
111 EOF
112 if [ $? -ne 0 ] ; then fail ; fi
113
114 pass;