From: John Darrington Date: Sun, 8 May 2005 23:17:05 +0000 (+0000) Subject: Fixed bug #13024 X-Git-Tag: v0.4.0~82 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d5ed89b7cdcb9dc2ea761cef3f04df3d2599436;p=pspp-builds.git Fixed bug #13024 --- diff --git a/src/ChangeLog b/src/ChangeLog index e48267b9..6ee4db12 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +Mon May 9 07:14:29 WST 2005 John Darrington + + * sysfile-info.c: Fixed bug [# 13024 ] + Sun May 8 13:52:12 2005 Ben Pfaff "Fix" PR 13021 by disabling FILE TYPE. Eventually, we should diff --git a/src/sysfile-info.c b/src/sysfile-info.c index 860d74f2..6c5d533d 100644 --- a/src/sysfile-info.c +++ b/src/sysfile-info.c @@ -49,7 +49,7 @@ enum AS_VECTOR }; -int describe_variable (struct variable *v, struct tab_table *t, int r, int as); +static int describe_variable (struct variable *v, struct tab_table *t, int r, int as); /* Sets the widths of all the columns and heights of all the rows in table T for driver D. */ @@ -128,6 +128,7 @@ cmd_sysfile_info (void) tab_submit (t); nr = 1 + 2 * dict_get_var_cnt (d); + t = tab_create (4, nr, 1); tab_dim (t, sysfile_info_dim); tab_headers (t, 0, 0, 1, 0); @@ -138,7 +139,7 @@ cmd_sysfile_info (void) for (r = 1, i = 0; i < dict_get_var_cnt (d); i++) { struct variable *v = dict_get_var (d, i); - int nvl = val_labs_count (v->val_labs); + const int nvl = val_labs_count (v->val_labs); if (r + 10 + nvl > nr) { @@ -149,10 +150,11 @@ cmd_sysfile_info (void) r = describe_variable (v, t, r, AS_DICTIONARY); } + tab_box (t, TAL_1, TAL_1, -1, -1, 0, 0, 3, r); - tab_vline (t, TAL_1, 0, 0, r); tab_vline (t, TAL_1, 1, 0, r); tab_vline (t, TAL_1, 3, 0, r); + tab_resize (t, -1, r); tab_flags (t, SOMF_NO_TITLE); tab_submit (t); @@ -425,7 +427,7 @@ display_variables (struct variable **vl, int n, int as) /* Puts a description of variable V into table T starting at row R. The variable will be described in the format AS. Returns the next row available for use in the table. */ -int +static int describe_variable (struct variable *v, struct tab_table *t, int r, int as) { /* Put the name, var label, and position into the first row. */ @@ -608,3 +610,14 @@ display_vectors (int sorted) free (vl); } + + + + + + + + + + + diff --git a/tests/Makefile.am b/tests/Makefile.am index d5ffed1f..e124e1aa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -32,6 +32,7 @@ TESTS = \ command/sort.sh \ command/sysfiles.sh \ command/sysfiles-old.sh \ + command/sysfile-info.sh \ command/split-file.sh \ command/t-test-1-indep-val.sh \ command/t-test-1-sample-missing-anal.sh \ diff --git a/tests/command/sysfile-info.sh b/tests/command/sysfile-info.sh new file mode 100755 index 00000000..4f08b166 --- /dev/null +++ b/tests/command/sysfile-info.sh @@ -0,0 +1,109 @@ +#!/bin/sh + +# This program tests that SYSFILE INFO works. + +TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/`basename $0`.sps + +here=`pwd`; + +# ensure that top_srcdir is absolute +cd $top_srcdir; top_srcdir=`pwd` + +export STAT_CONFIG_PATH=$top_srcdir/config + + +cleanup() +{ + if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then + echo "NOT cleaning $TEMPDIR" + return ; + fi + 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 test file" +cat > $TESTFILE << EOF +DATA LIST LIST /x * name (a10) . +BEGIN DATA +1 one +2 two +3 three +END DATA. +SAVE OUTFILE='pro.sav'. + +sysfile info file='pro.sav'. +EOF +if [ $? -ne 0 ] ; then no_result ; fi + + +activity="run program" +$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE +if [ $? -ne 0 ] ; then no_result ; fi + +activity="filter output" +grep -v '^Created: ' $TEMPDIR/pspp.list > $TEMPDIR/out-filtered +if [ $? -ne 0 ] ; then no_result ; fi + +activity="compare output" +diff $TEMPDIR/out-filtered - << EOF +1.1 DATA LIST. Reading free-form data from the command file. ++--------+------+ +|Variable|Format| +#========#======# +|x |F8.0 | +|name |A10 | ++--------+------+ + +2.1 SYSFILE INFO. +File: pro.sav +Label: No label. +Endian: Little. +Variables: 2 +Cases: 3 +Type: System File. +Weight: Not weighted. +Mode: Compression off. + ++--------+-------------+---+ +|Variable|Description |Pos| +| | |iti| +| | |on | +#========#=============#===# +|x |Format: F8.2 | 1| ++--------+-------------+---+ +|name |Format: A10 | 2| ++--------+-------------+---+ + +EOF +if [ $? -ne 0 ] ; then fail ; fi + +pass; diff --git a/tests/test_template b/tests/test_template index 664549cd..a0f70b05 100755 --- a/tests/test_template +++ b/tests/test_template @@ -3,6 +3,7 @@ # This program tests .... TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/`basename $0`.sps here=`pwd`; @@ -14,6 +15,10 @@ export STAT_CONFIG_PATH=$top_srcdir/config cleanup() { + if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then + echo "NOT cleaning $TEMPDIR" + return ; + fi rm -rf $TEMPDIR } @@ -46,10 +51,15 @@ mkdir -p $TEMPDIR cd $TEMPDIR put test set up here ... +if [ $? -ne 0 ] ; then no_result ; fi + +activity="run program" +$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi + put test here if [ $? -ne 0 ] ; then fail ; fi