Initial implementation of the Kruskal-Wallis test.
[pspp-builds.git] / tests / output / paper-size.sh
1 #!/bin/sh
2
3 # This program tests paper size support.
4
5 TEMPDIR=/tmp/pspp-tst-$$
6
7 # ensure that top_builddir  are absolute
8 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 top_builddir=`cd $top_builddir; pwd`
11 PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
12
13 # ensure that top_srcdir is absolute
14 top_srcdir=`cd $top_srcdir; pwd`
15
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
18
19 LANG=C
20 export LANG
21
22 cleanup()
23 {
24      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
25         echo "NOT cleaning $TEMPDIR" 
26         return ; 
27      fi
28      cd /
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 File 1"
61 cat > paper-size.pspp <<EOF
62 debug paper size ''.
63 debug paper size 'a4'.
64 debug paper size 'letter'.
65 debug paper size '10x14in'.
66 debug paper size '210x297mm'.
67 EOF
68 if [ $? -ne 0 ] ; then no_result ; fi
69
70 activity="Run pspp 1"
71 PAPERSIZE=letter $SUPERVISOR $PSPP --testing-mode -o pspp.csv paper-size.pspp > paper-size.out
72 if [ $? -ne 0 ] ; then no_result ; fi
73
74 activity="compare results"
75 diff -b  $TEMPDIR/paper-size.out - <<EOF
76 "" => 8.5 x 11.0 in, 216 x 279 mm
77 "a4" => 8.3 x 11.7 in, 210 x 297 mm
78 "letter" => 8.5 x 11.0 in, 216 x 279 mm
79 "10x14in" => 10.0 x 14.0 in, 254 x 356 mm
80 "210x297mm" => 8.3 x 11.7 in, 210 x 297 mm
81 EOF
82 if [ $? -ne 0 ] ; then fail ; fi
83
84 activity="Create File 2"
85 cat > paper-size-2.pspp <<EOF
86 debug paper size ''.
87 EOF
88 if [ $? -ne 0 ] ; then no_result ; fi
89
90 activity="Run pspp 2"
91 PAPERSIZE=a4 $SUPERVISOR $PSPP --testing-mode -o pspp.csv paper-size-2.pspp > paper-size-2.out
92 if [ $? -ne 0 ] ; then no_result ; fi
93
94 activity="compare results 2"
95 diff -b  $TEMPDIR/paper-size-2.out - <<EOF
96 "" => 8.3 x 11.7 in, 210 x 297 mm
97 EOF
98 if [ $? -ne 0 ] ; then fail ; fi
99
100 pass;