Merge commit 'origin/stable'
[pspp-builds.git] / tests / command / npar-sign.sh
1 #!/bin/sh
2
3 # This program tests the SIGN subcommand of npar tests
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 # ensure that top_srcdir and top_builddir  are absolute
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 top_srcdir=`cd $top_srcdir; pwd`
12 top_builddir=`cd $top_builddir; pwd`
13
14 PSPP=$top_builddir/src/ui/terminal/pspp
15
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
18
19 LANG=C
20 export LANG
21
22
23 cleanup()
24 {
25      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
26         echo "NOT cleaning $TEMPDIR"
27         return ; 
28      fi
29      rm -rf $TEMPDIR
30 }
31
32
33 fail()
34 {
35     echo $activity
36     echo FAILED
37     cleanup;
38     exit 1;
39 }
40
41
42 no_result()
43 {
44     echo $activity
45     echo NO RESULT;
46     cleanup;
47     exit 2;
48 }
49
50 pass()
51 {
52     cleanup;
53     exit 0;
54 }
55
56 mkdir -p $TEMPDIR
57
58 cd $TEMPDIR
59
60 activity="create program 1"
61 cat > $TESTFILE <<  EOF
62 set format = F9.3.
63
64 data list notable list /age * height rank *.
65 begin data.
66 10 12 11
67 12 13 13 
68 13 14 12
69 12 12 10
70 9   9 10
71 10.3 10.2 12
72 end data.
73
74 npar tests
75         /sign=age height WITH height rank (PAIRED)
76         /MISSING ANALYSIS
77         /METHOD=EXACT
78         .
79 EOF
80 if [ $? -ne 0 ] ; then no_result ; fi
81
82
83 activity="run program 1"
84 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
85 if [ $? -ne 0 ] ; then no_result ; fi
86
87 activity="compare output 1"
88 diff - $TEMPDIR/pspp.list <<EOF
89 1.1 NPAR TESTS.  Frequencies
90 #=================================#=#
91 #                                 |N#
92 #---------------------------------+-#
93 #height - age Negative Differences|1#
94 #             Positive Differences|3#
95 #             Ties                |2#
96 #             Total               |6#
97 #---------------------------------+-#
98 #rank - heightNegative Differences|3#
99 #             Positive Differences|2#
100 #             Ties                |1#
101 #             Total               |6#
102 #=================================#=#
103
104 1.2 NPAR TESTS.  Test Statistics
105 #=====================#============#=============#
106 #                     |height - age|rank - height#
107 #=====================#============#=============#
108 #Exact Sig. (2-tailed)|        .625|        1.000#
109 #Exact Sig. (1-tailed)|        .312|         .500#
110 #Point Probability    |        .250|         .312#
111 #=====================#============#=============#
112
113 EOF
114 if [ $? -ne 0 ] ; then fail ; fi
115
116
117 pass;