Checkin of new directory structure.
[pspp-builds.git] / tests / command / aggregate.sh
index 108336d0d75117ac50a6f46acae243601421d62a..36a9feffcd842f15ab2dc068cd11e634e2f96e92 100755 (executable)
@@ -6,16 +6,19 @@ TEMPDIR=/tmp/pspp-tst-$$
 TESTFILE=$TEMPDIR/aggregate.pspp
 
 
-here=`pwd`;
+# ensure that top_srcdir and top_builddir  are absolute
+if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
+if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
+top_srcdir=`cd $top_srcdir; pwd`
+top_builddir=`cd $top_builddir; pwd`
 
-# ensure that top_srcdir is absolute
-cd $top_srcdir; top_srcdir=`pwd`
 
-
-export STAT_CONFIG_PATH=$top_srcdir/config
+STAT_CONFIG_PATH=$top_srcdir/config
+export STAT_CONFIG_PATH
 
 cleanup()
 {
+     cd /
      rm -rf $TEMPDIR
 }
 
@@ -68,80 +71,80 @@ activity="command skeleton create"
 cat > agg-skel.pspp <<EOF
        /document
        /break=g
-       /n = n
-       /ni = n./
-       nu = nu
-       /nui = nu./
-       nfgt2 = fgt(n, 2)
-       /nfgt2i = fgt.(n, 2)
-       /sfgt2 = fgt(s, '2')
-       /sfgt2i = fgt.(s, '2')
-       /nfin23 = fin(n, 2, 3)
-       /nfin23i = fin.(n, 2, 3)
-       /sfin23 = fin(s, '2', '3')
-       /sfin23i = fin.(s, '2', '3')
-       /nflt2 = flt(n, 2)
-       /nflt2i = flt.(n, 2)
-       /sflt2 = flt(s, '2')
-       /sflt2i = flt.(s, '2')
-       /nfirst = first(n)
-       /nfirsti = first.(n)
-       /sfirst = first(s)
-       /sfirsti = first.(s)
-       /nfout23 = fout(n, 3, 2)
-       /nfout23i = fout.(n, 3, 2)
-       /sfout23 = fout(s, '3', '2')
-       /sfout23i = fout.(s, '3', '2')
-       /nlast = last(n)
-       /nlasti = last.(n)
-       /slast = last(s)
-       /slasti = last.(s)
-       /nmax = max(n)
-       /nmaxi = max.(n)
-       /smax = max(s)
-       /smaxi = max.(s)
-       /nmean = mean(n)
-       /nmeani = mean.(n)
-       /nmin = min(n)
-       /nmini = min.(n)
-       /smin = min(s)
-       /smini = min.(s)
-       /nn = n(n)
-       /nni = n.(n)
-       /sn = n(s)
-       /sni = n.(s)
-       /nnmiss = nmiss(n)
-       /nnmissi = nmiss.(n)
-       /snmiss = nmiss(s)
-       /snmissi = nmiss.(s)
-       /nnu = nu(n)
-       /nnui = nu.(n)
-       /snu = nu(s)
-       /snui = nu.(s)
-       /nnumiss = numiss(n)
-       /nnumissi = numiss.(n)
-       /snumiss = numiss(s)
-       /snumissi = numiss.(s)
-       /npgt2 = pgt(n, 2)
-       /npgt2i = pgt.(n, 2)
-       /spgt2 = pgt(s, '2')
-       /spgt2i = pgt.(s, '2')
-       /npin23 = pin(n, 2, 3)
-       /npin23i = pin.(n, 2, 3)
-       /spin23 = pin(s, '2', '3')
-       /spin23i = pin.(s, '2', '3')
-       /nplt2 = plt(n, 2)
-       /nplt2i = plt.(n, 2)
-       /splt2 = plt(s, '2')
-       /splt2i = plt.(s, '2')
-       /npout23 = pout(n, 2, 3)
-       /npout23i = pout.(n, 2, 3)
-       /spout23 = pout(s, '2', '3')
-       /spout23i = pout.(s, '2', '3')
-       /nsd = sd(n)
-       /nsdi = sd.(n)
-       /nsum = sum(n)
-       /nsumi = sum.(n).
+       /N = n
+       /NI = n./
+       NU = nu
+       /NUI = nu./
+       NFGT2 = fgt(n, 2)
+       /NFGT2I = fgt.(n, 2)
+       /SFGT2 = fgt(s, '2')
+       /SFGT2I = fgt.(s, '2')
+       /NFIN23 = fin(n, 2, 3)
+       /NFIN23I = fin.(n, 2, 3)
+       /SFIN23 = fin(s, '2', '3')
+       /SFIN23I = fin.(s, '2', '3')
+       /NFLT2 = flt(n, 2)
+       /NFLT2I = flt.(n, 2)
+       /SFLT2 = flt(s, '2')
+       /SFLT2I = flt.(s, '2')
+       /NFIRST = first(n)
+       /NFIRSTI = first.(n)
+       /SFIRST = first(s)
+       /SFIRSTI = first.(s)
+       /NFOUT23 = fout(n, 3, 2)
+       /NFOUT23I = fout.(n, 3, 2)
+       /SFOUT23 = fout(s, '3', '2')
+       /SFOUT23I = fout.(s, '3', '2')
+       /NLAST = last(n)
+       /NLASTI = last.(n)
+       /SLAST = last(s)
+       /SLASTI = last.(s)
+       /NMAX = max(n)
+       /NMAXI = max.(n)
+       /SMAX = max(s)
+       /SMAXI = max.(s)
+       /NMEAN = mean(n)
+       /NMEANI = mean.(n)
+       /NMIN = min(n)
+       /NMINI = min.(n)
+       /SMIN = min(s)
+       /SMINI = min.(s)
+       /NN = n(n)
+       /NNI = n.(n)
+       /SN = n(s)
+       /SNI = n.(s)
+       /NNMISS = nmiss(n)
+       /NNMISSI = nmiss.(n)
+       /SNMISS = nmiss(s)
+       /SNMISSI = nmiss.(s)
+       /NNU = nu(n)
+       /NNUI = nu.(n)
+       /SNU = nu(s)
+       /SNUI = nu.(s)
+       /NNUMISS = numiss(n)
+       /NNUMISSI = numiss.(n)
+       /SNUMISS = numiss(s)
+       /SNUMISSI = numiss.(s)
+       /NPGT2 = pgt(n, 2)
+       /NPGT2I = pgt.(n, 2)
+       /SPGT2 = pgt(s, '2')
+       /SPGT2I = pgt.(s, '2')
+       /NPIN23 = pin(n, 2, 3)
+       /NPIN23I = pin.(n, 2, 3)
+       /SPIN23 = pin(s, '2', '3')
+       /SPIN23I = pin.(s, '2', '3')
+       /NPLT2 = plt(n, 2)
+       /NPLT2I = plt.(n, 2)
+       /SPLT2 = plt(s, '2')
+       /SPLT2I = plt.(s, '2')
+       /NPOUT23 = pout(n, 2, 3)
+       /NPOUT23I = pout.(n, 2, 3)
+       /SPOUT23 = pout(s, '2', '3')
+       /SPOUT23I = pout.(s, '2', '3')
+       /NSD = sd(n)
+       /NSDI = sd.(n)
+       /NSUM = sum(n)
+       /NSUMI = sum.(n).
 EOF
 
 activity="expected output (itemwise missing) create"
@@ -164,14 +167,14 @@ G        N       NI      NU     NUI NFGT2 NFGT2I SFGT2 SFGT2I NFIN23 NFIN23I SFI
 4     1.00     1.00       1       1  .      .     .     1.000   .       .      .       .000  .      .     .      .000      .       .              4    .        .       .       1.000     .      .            4    .     .          4      .        .      .     .          4      .00      .00      .00     1.00     1.00     1.00     1.00      .00       0       0       0       1       1        1       1        0    .      .     .   100.0     .       .      .       .0    .      .     .      .0      .        .       .     100.0      .        .        .        .   
 EOF
 
-for outfile in active external; do
+for outfile in scratch active external; do
     for sort in presorted unsorted; do
        for missing in itemwise columnwise; do
            name=$outfile-$sort-$missing
 
            activity="create $name.pspp"
            {
-               echo "data list notable file='aggregate.data' /g n 1-2 s 3(a) w 4."
+               echo "data list notable file='aggregate.data' /G N 1-2 S 3(a) W 4."
                echo "weight by w."
                echo "missing values n(4) s('4')."
                if [ "$sort" = "presorted" ]; then
@@ -180,8 +183,10 @@ for outfile in active external; do
                echo "aggregate"
                if [ "$outfile" = "active" ]; then
                    echo "      outfile=*"
-               else
+               elif [ "$outfile" = "external" ]; then
                    echo "      outfile='aggregate.sys'"
+               else
+                   echo "      outfile=#AGGREGATE"
                fi
                if [ "$sort" = "presorted" ]; then
                    echo "      /presorted"
@@ -192,21 +197,23 @@ for outfile in active external; do
                cat agg-skel.pspp
                if [ "$outfile" = "external" ]; then
                    echo "get file='aggregate.sys'."
+               elif [ "$outfile" = "scratch" ]; then
+                   echo "get file=#AGGREGATE."
                fi
                echo "list."
            } > $name.pspp
            if [ $? -ne 0 ] ; then no_result ; fi
            
            activity="run $name.pspp"
-           $SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $name.pspp >/dev/null 2>&1
+           $SUPERVISOR $top_builddir/src/pspp --testing-mode -o raw-ascii $name.pspp >/dev/null 2>&1
            if [ $? -ne 0 ] ; then no_result ; fi
 
            activity="check $name output"
-           diff -b -w -B pspp.list agg-$missing.out
+           perl -pi -e 's/^\s*$//g' pspp.list agg-$missing.out
+           diff -b -w pspp.list agg-$missing.out
            if [ $? -ne 0 ] ; then fail ; fi
        done
     done
 done
 
-exit 0
 pass;