pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/tests/command rank.sh [simpler-proc]


From: Ben Pfaff
Subject: [Pspp-cvs] pspp/tests/command rank.sh [simpler-proc]
Date: Mon, 23 Apr 2007 01:26:19 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Branch:         simpler-proc
Changes by:     Ben Pfaff <blp> 07/04/23 01:26:19

Modified files:
        tests/command  : rank.sh 

Log message:
        Revert to version in main branch.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/tests/command/rank.sh?cvsroot=pspp&only_with_tag=simpler-proc&r1=1.4.2.1&r2=1.4.2.2

Patches:
Index: rank.sh
===================================================================
RCS file: /cvsroot/pspp/pspp/tests/command/rank.sh,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -b -r1.4.2.1 -r1.4.2.2
--- rank.sh     19 Mar 2007 21:36:25 -0000      1.4.2.1
+++ rank.sh     23 Apr 2007 01:26:19 -0000      1.4.2.2
@@ -58,6 +58,91 @@
 cd $TEMPDIR
 
 
+# Some tests for proper behaviour in the face of invalid input.
+activity="create file 1"
+cat > $TESTFILE <<EOF
+DATA LIST LIST NOTABLE /x * a (a2).
+BEGIN DATA.
+-1 s
+0  s
+1  s
+2  s
+2  s
+4  s
+5  s
+END DATA.
+
+DEBUG XFORM FAIL.
+
+RANK x.
+
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+# Check that it properly handles failed transformations.
+activity="run program 1"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii -e $TEMPDIR/err $TESTFILE 
+if [ $? -ne 1 ] ; then fail ; fi
+
+activity="diff 1"
+perl -pi -e 's/^\s*$//g' $TEMPDIR/err
+diff  -b $TEMPDIR/err - <<EOF
+$TEMPDIR/rank.sh.sps:14: error: Stopping syntax file processing here to avoid 
a cascade of dependent command failures.
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+#Now for some general error conditions.
+activity="create file 2"
+cat > $TESTFILE <<EOF
+DATA LIST LIST NOTABLE /x * a (a2).
+BEGIN DATA.
+-1 s
+0  s
+1  s
+2  s
+2  s
+4  s
+5  s
+END DATA.
+
+* invalid NTILES (no parameter)
+RANK x 
+  /NTILES
+.
+
+* invalid NTILES (not an integer)
+RANK x 
+  /NTILES(d)
+.
+
+
+* destination variable already exists
+RANK x 
+ /RANK INTO x.
+
+
+* Too many variables in INTO
+RANK x 
+ /RANK INTO foo  bar wiz.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program (syntax errors)"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii -e $TEMPDIR/errs $TESTFILE 
+if [ $? -ne 1 ] ; then fail ; fi
+
+activity="compare errors"
+perl -pi -e 's/^\s*$//g' $TEMPDIR/errs
+diff  -b $TEMPDIR/errs - << EOF
+$TEMPDIR/rank.sh.sps:15: error: RANK: Syntax error expecting \`(' at end of 
command.
+$TEMPDIR/rank.sh.sps:19: error: RANK: Syntax error expecting integer at \`d'.
+$TEMPDIR/rank.sh.sps:25: error: RANK: Variable x already exists.
+$TEMPDIR/rank.sh.sps:30: error: RANK: Too many variables in INTO clause.
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
 # Now some real tests.
 
 activity="create file 3"
@@ -234,11 +319,11 @@
 
 WEIGHT BY w.
 
-
 RANK x
  /TIES=low
  /RANK into xl.
 
+
 RANK x
  /TIES=high
  /RANK into xh.
@@ -249,9 +334,10 @@
 
 
 * Test VW fraction
+
 RANK x
  /FRACTION=VW
- /NORMAL into Nx.
+ /NORMAL.
 
 LIST.
 EOF




reply via email to

[Prev in Thread] Current Thread [Next in Thread]