Fixed some tests that were failing under cygwin
[pspp-builds.git] / tests / command / examine-extremes.sh
1 #!/bin/sh
2
3 # This program tests  the EXTREME subcommand of the EXAMINE command.
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 export STAT_CONFIG_PATH=$top_srcdir/config
14
15
16 cleanup()
17 {
18      rm -rf $TEMPDIR
19 }
20
21
22 fail()
23 {
24     echo $activity
25     echo FAILED
26     cleanup;
27     exit 1;
28 }
29
30
31 no_result()
32 {
33     echo $activity
34     echo NO RESULT;
35     cleanup;
36     exit 2;
37 }
38
39 pass()
40 {
41     cleanup;
42     exit 0;
43 }
44
45 mkdir -p $TEMPDIR
46
47 cd $TEMPDIR
48
49 activity="create program"
50 cat > $TESTFILE <<EOF
51 data list free /v1 w
52 begin data.
53 1  1
54 2  1
55 3  2
56 3  1
57 4  1
58 5  1
59 6  1
60 7  1
61 8  1
62 9  1
63 10 1
64 11 1
65 12 1
66 13 1
67 14 1
68 15 1
69 16 1
70 17 1
71 18 2
72 19 1
73 20 1
74 end data.
75
76 weight by w.
77
78 examine v1 
79  /statistics=extreme(6)
80  .
81 EOF
82 if [ $? -ne 0 ] ; then no_result ; fi
83
84
85 activity="run program"
86 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
87 if [ $? -ne 0 ] ; then no_result ; fi
88
89 activity="compare results"
90 diff -b -B $TEMPDIR/pspp.list - << EOF
91 1.1 EXAMINE.  Case Processing Summary
92 #==#===============================#
93 #  #             Cases             #
94 #  #----------+---------+----------#
95 #  #   Valid  | Missing |   Total  #
96 #  #--+-------+-+-------+--+-------#
97 #  # N|Percent|N|Percent| N|Percent#
98 #==#==#=======#=#=======#==#=======#
99 #V1#23|   100%|0|     0%|23|   100%#
100 #==#==#=======#=#=======#==#=======#
101
102 1.2 EXAMINE.  Extreme Values
103 #==========#===========#=====#
104 #          #Case Number|Value#
105 #==========#===========#=====#
106 #V1Highest1#         21|20.00#
107 #         2#         20|19.00#
108 #         3#         19|18.00#
109 #         4#         19|18.00#
110 #         5#         18|17.00#
111 #         6#         17|16.00#
112 #  --------#-----------+-----#
113 #   Lowest1#          1| 1.00#
114 #         2#          2| 2.00#
115 #         3#          4| 3.00#
116 #         4#          3| 3.00#
117 #         5#          3| 3.00#
118 #         6#          5| 4.00#
119 #==========#===========#=====#
120
121 EOF
122 if [ $? -ne 0 ] ; then fail ; fi
123
124 pass