WEIGHT: Convert test to Autotest framework.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Oct 2010 00:38:14 +0000 (17:38 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Oct 2010 00:38:14 +0000 (17:38 -0700)
tests/automake.mk
tests/command/weight.sh [deleted file]
tests/language/dictionary/weight.at [new file with mode: 0644]
tests/weighting.data [deleted file]

index 7ee732cbf109413385ca7733695a831dbf269b7f..f84097e2a9b8d7627da85a4ddac08ab8cd9eddce 100644 (file)
@@ -11,7 +11,6 @@ TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
 
 dist_TESTS = \
        tests/command/very-long-strings.sh \
-       tests/command/weight.sh \
        tests/formats/bcd-in.sh \
        tests/formats/binhex-out.sh \
        tests/formats/date-in.sh \
@@ -254,7 +253,6 @@ tests_output_render_test_LDADD = \
 
 EXTRA_DIST += \
        $(dist_TESTS) \
-       tests/weighting.data \
        tests/coverage.sh tests/test_template \
        tests/v13.sav tests/v14.sav \
        tests/expressions/randist/beta.out \
@@ -337,6 +335,7 @@ TESTSUITE_AT = \
        tests/language/dictionary/sys-file-info.at \
        tests/language/dictionary/variable-display.at \
        tests/language/dictionary/vector.at \
+       tests/language/dictionary/weight.at \
        tests/language/expressions/evaluate.at \
        tests/language/lexer/variable-parser.at \
        tests/language/stats/aggregate.at \
diff --git a/tests/command/weight.sh b/tests/command/weight.sh
deleted file mode 100755 (executable)
index d82cef9..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/bin/sh
-
-# This program tests the WEIGHT command
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_builddir  are absolute
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
-
-# ensure that top_srcdir is absolute
-top_srcdir=`cd $top_srcdir; pwd`
-
-STAT_CONFIG_PATH=$top_srcdir/config
-export STAT_CONFIG_PATH
-
-LANG=C
-export LANG
-
-
-cleanup()
-{
-     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
-       echo "NOT cleaning $TEMPDIR"
-       return ; 
-     fi
-     cd /
-     rm -rf $TEMPDIR
-}
-
-
-fail()
-{
-    echo $activity
-    echo FAILED
-    cleanup;
-    exit 1;
-}
-
-
-no_result()
-{
-    echo $activity
-    echo NO RESULT;
-    cleanup;
-    exit 2;
-}
-
-pass()
-{
-    cleanup;
-    exit 0;
-}
-
-mkdir -p $TEMPDIR
-
-cd $TEMPDIR
-
-activity="create program"
-cat > $TESTFILE << EOF
-SET FORMAT F8.3.
-data list file='$top_srcdir/tests/weighting.data'/AVAR 1-5 BVAR 6-10.
-weight by BVAR.
-
-descriptives AVAR /statistics all /format serial.
-frequencies AVAR /statistics all.
-
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare results"
-diff -c $TEMPDIR/pspp.csv - <<EOF
-Table: Reading 1 record from \`$top_srcdir/tests/weighting.data'.
-Variable,Record,Columns,Format
-AVAR,1,1-  5,F5.0
-BVAR,1,6- 10,F5.0
-
-Table: Valid cases = 730; cases with missing value(s) = 0.
-Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum
-AVAR,730,0,31.515,.405,10.937,119.608,2.411,.181,1.345,.090,76.000,18.000,94.000,23006.00
-
-Table: AVAR
-Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
-,18,1,.137,.137,.137
-,19,7,.959,.959,1.096
-,20,26,3.562,3.562,4.658
-,21,76,10.411,10.411,15.068
-,22,57,7.808,7.808,22.877
-,23,58,7.945,7.945,30.822
-,24,38,5.205,5.205,36.027
-,25,38,5.205,5.205,41.233
-,26,30,4.110,4.110,45.342
-,27,21,2.877,2.877,48.219
-,28,23,3.151,3.151,51.370
-,29,24,3.288,3.288,54.658
-,30,23,3.151,3.151,57.808
-,31,14,1.918,1.918,59.726
-,32,21,2.877,2.877,62.603
-,33,21,2.877,2.877,65.479
-,34,14,1.918,1.918,67.397
-,35,14,1.918,1.918,69.315
-,36,17,2.329,2.329,71.644
-,37,11,1.507,1.507,73.151
-,38,16,2.192,2.192,75.342
-,39,14,1.918,1.918,77.260
-,40,15,2.055,2.055,79.315
-,41,14,1.918,1.918,81.233
-,42,14,1.918,1.918,83.151
-,43,8,1.096,1.096,84.247
-,44,15,2.055,2.055,86.301
-,45,10,1.370,1.370,87.671
-,46,12,1.644,1.644,89.315
-,47,13,1.781,1.781,91.096
-,48,13,1.781,1.781,92.877
-,49,5,.685,.685,93.562
-,50,5,.685,.685,94.247
-,51,3,.411,.411,94.658
-,52,7,.959,.959,95.616
-,53,6,.822,.822,96.438
-,54,2,.274,.274,96.712
-,55,2,.274,.274,96.986
-,56,2,.274,.274,97.260
-,57,3,.411,.411,97.671
-,58,1,.137,.137,97.808
-,59,3,.411,.411,98.219
-,61,1,.137,.137,98.356
-,62,3,.411,.411,98.767
-,63,1,.137,.137,98.904
-,64,1,.137,.137,99.041
-,65,2,.274,.274,99.315
-,70,1,.137,.137,99.452
-,78,1,.137,.137,99.589
-,79,1,.137,.137,99.726
-,80,1,.137,.137,99.863
-,94,1,.137,.137,100.000
-Total,,730,100.0,100.0,
-
-Table: AVAR
-N,Valid,730
-,Missing,0
-Mean,,31.515
-S.E. Mean,,.405
-Mode,,21.000
-Std Dev,,10.937
-Variance,,119.608
-Kurtosis,,2.411
-S.E. Kurt,,.181
-Skewness,,1.345
-S.E. Skew,,.090
-Range,,76.000
-Minimum,,18.000
-Maximum,,94.000
-Sum,,23006.00
-Percentiles,50 (Median),29
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/language/dictionary/weight.at b/tests/language/dictionary/weight.at
new file mode 100644 (file)
index 0000000..0eb55bc
--- /dev/null
@@ -0,0 +1,151 @@
+AT_BANNER([WEIGHT])
+
+AT_SETUP([WEIGHT])
+AT_DATA([weight.txt], [dnl
+   18    1
+   19    7
+   20   26
+   21   76
+   22   57
+   23   58
+   24   38
+   25   38
+   26   30
+   27   21
+   28   23
+   29   24
+   30   23
+   31   14
+   32   21
+   33   21
+   34   14
+   35   14
+   36   17
+   37   11
+   38   16
+   39   14
+   40   15
+   41   14
+   42   14
+   43    8
+   44   15
+   45   10
+   46   12
+   47   13
+   48   13
+   49    5
+   50    5
+   51    3
+   52    7
+   53    6
+   54    2
+   55    2
+   56    2
+   57    3
+   58    1
+   59    3
+   61    1
+   62    3
+   63    1
+   64    1
+   65    2
+   70    1
+   78    1
+   79    1
+   80    1
+   94    1
+])
+AT_DATA([weight.sps], [dnl
+SET FORMAT F8.3.
+data list file='weight.txt'/AVAR 1-5 BVAR 6-10.
+weight by BVAR.
+
+descriptives AVAR /statistics all /format serial.
+frequencies AVAR /statistics all.
+])
+AT_CHECK([pspp -o pspp.csv weight.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Reading 1 record from `weight.txt'.
+Variable,Record,Columns,Format
+AVAR,1,1-  5,F5.0
+BVAR,1,6- 10,F5.0
+
+Table: Valid cases = 730; cases with missing value(s) = 0.
+Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum
+AVAR,730,0,31.515,.405,10.937,119.608,2.411,.181,1.345,.090,76.000,18.000,94.000,23006.00
+
+Table: AVAR
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,18,1,.137,.137,.137
+,19,7,.959,.959,1.096
+,20,26,3.562,3.562,4.658
+,21,76,10.411,10.411,15.068
+,22,57,7.808,7.808,22.877
+,23,58,7.945,7.945,30.822
+,24,38,5.205,5.205,36.027
+,25,38,5.205,5.205,41.233
+,26,30,4.110,4.110,45.342
+,27,21,2.877,2.877,48.219
+,28,23,3.151,3.151,51.370
+,29,24,3.288,3.288,54.658
+,30,23,3.151,3.151,57.808
+,31,14,1.918,1.918,59.726
+,32,21,2.877,2.877,62.603
+,33,21,2.877,2.877,65.479
+,34,14,1.918,1.918,67.397
+,35,14,1.918,1.918,69.315
+,36,17,2.329,2.329,71.644
+,37,11,1.507,1.507,73.151
+,38,16,2.192,2.192,75.342
+,39,14,1.918,1.918,77.260
+,40,15,2.055,2.055,79.315
+,41,14,1.918,1.918,81.233
+,42,14,1.918,1.918,83.151
+,43,8,1.096,1.096,84.247
+,44,15,2.055,2.055,86.301
+,45,10,1.370,1.370,87.671
+,46,12,1.644,1.644,89.315
+,47,13,1.781,1.781,91.096
+,48,13,1.781,1.781,92.877
+,49,5,.685,.685,93.562
+,50,5,.685,.685,94.247
+,51,3,.411,.411,94.658
+,52,7,.959,.959,95.616
+,53,6,.822,.822,96.438
+,54,2,.274,.274,96.712
+,55,2,.274,.274,96.986
+,56,2,.274,.274,97.260
+,57,3,.411,.411,97.671
+,58,1,.137,.137,97.808
+,59,3,.411,.411,98.219
+,61,1,.137,.137,98.356
+,62,3,.411,.411,98.767
+,63,1,.137,.137,98.904
+,64,1,.137,.137,99.041
+,65,2,.274,.274,99.315
+,70,1,.137,.137,99.452
+,78,1,.137,.137,99.589
+,79,1,.137,.137,99.726
+,80,1,.137,.137,99.863
+,94,1,.137,.137,100.000
+Total,,730,100.0,100.0,
+
+Table: AVAR
+N,Valid,730
+,Missing,0
+Mean,,31.515
+S.E. Mean,,.405
+Mode,,21.000
+Std Dev,,10.937
+Variance,,119.608
+Kurtosis,,2.411
+S.E. Kurt,,.181
+Skewness,,1.345
+S.E. Skew,,.090
+Range,,76.000
+Minimum,,18.000
+Maximum,,94.000
+Sum,,23006.00
+Percentiles,50 (Median),29
+])
+AT_CLEANUP
diff --git a/tests/weighting.data b/tests/weighting.data
deleted file mode 100644 (file)
index bf74fa0..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-   18    1
-   19    7
-   20   26
-   21   76
-   22   57
-   23   58
-   24   38
-   25   38
-   26   30
-   27   21
-   28   23
-   29   24
-   30   23
-   31   14
-   32   21
-   33   21
-   34   14
-   35   14
-   36   17
-   37   11
-   38   16
-   39   14
-   40   15
-   41   14
-   42   14
-   43    8
-   44   15
-   45   10
-   46   12
-   47   13
-   48   13
-   49    5
-   50    5
-   51    3
-   52    7
-   53    6
-   54    2
-   55    2
-   56    2
-   57    3
-   58    1
-   59    3
-   61    1
-   62    3
-   63    1
-   64    1
-   65    2
-   70    1
-   78    1
-   79    1
-   80    1
-   94    1
\ No newline at end of file