[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp src/language/stats/flip.c tests/command/fl...
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp src/language/stats/flip.c tests/command/fl... |
Date: |
Wed, 25 Jul 2007 04:03:59 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Changes by: Ben Pfaff <blp> 07/07/25 04:03:59
Modified files:
src/language/stats: flip.c
tests/command : flip.sh
Log message:
Fix bugs #20493, #20494.
* flip.c (struct flip_pgm): Remove `case_size' member (now
unused).
(cmd_flip): Pass var_cnt as number of cases instead of case_cnt,
to fix bug #20494. Don't assign to `case_size' member, which was
unused after assignment.
(build_dictionary): When NEWNAMES not used, get the number of
variables right, to fix bug #20493.
* tests/command/flip.sh: Add tests to avoid regression on bugs
#20493, #20494.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/flip.c?cvsroot=pspp&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pspp/tests/command/flip.sh?cvsroot=pspp&r1=1.12&r2=1.13
Patches:
Index: src/language/stats/flip.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/stats/flip.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- src/language/stats/flip.c 7 Jul 2007 06:14:16 -0000 1.26
+++ src/language/stats/flip.c 25 Jul 2007 04:03:58 -0000 1.27
@@ -65,7 +65,6 @@
int *idx_to_fv; /* var[]->index to compacted sink case fv. */
size_t var_cnt; /* Number of elements in `var'. */
int case_cnt; /* Pre-flip case count. */
- size_t case_size; /* Post-flip bytes per case. */
struct variable *new_names; /* Variable containing new variable names. */
struct varname *new_names_head; /* First new variable. */
@@ -149,8 +148,7 @@
}
}
- output_buf = pool_nalloc (flip->pool,
- flip->var_cnt, sizeof *output_buf);
+ output_buf = pool_nalloc (flip->pool, flip->var_cnt, sizeof *output_buf);
flip->file = pool_tmpfile (flip->pool);
if (flip->file == NULL)
@@ -199,11 +197,10 @@
proc_discard_active_file (ds);
goto error;
}
- flip->case_size = dict_get_case_size (dict);
/* Set up flipped data for reading. */
reader = casereader_create_sequential (NULL, dict_get_next_value_idx (dict),
- flip->case_cnt,
+ flip->var_cnt,
&flip_casereader_class, flip);
proc_set_active_file_data (ds, reader);
return lex_end_of_command (lexer);
@@ -288,7 +285,7 @@
return false;
}
- for (i = 0; i < flip->case_cnt; i++)
+ for (i = 0; i < flip->case_cnt - 1; i++)
{
struct variable *v;
char s[SHORT_NAME_LEN + 1];
Index: tests/command/flip.sh
===================================================================
RCS file: /cvsroot/pspp/pspp/tests/command/flip.sh,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- tests/command/flip.sh 30 May 2006 12:01:34 -0000 1.12
+++ tests/command/flip.sh 25 Jul 2007 04:03:59 -0000 1.13
@@ -56,7 +56,8 @@
activity="create flip.stat"
cat > $TEMPDIR/flip.stat <<EOF
-data list /N 1 (a) A B C D 2-9.
+* Test FLIP with NEWNAME or, equivalently, with a variable named CASE_LBL.
+data list notable /N 1 (a) A B C D 2-9.
list.
begin data.
v 1 2 3 4 5
@@ -69,6 +70,19 @@
list.
flip.
list.
+
+* Test FLIP without NEWNAME.
+data list list notable /v1 to v10.
+format all(f2).
+begin data.
+1 2 3 4 5 6 7 8 9 10
+4 5 6 7 8 9 10 11 12 13
+end data.
+
+list.
+
+flip.
+list.
EOF
if [ $? -ne 0 ] ; then no_result ; fi
@@ -80,16 +94,6 @@
activity="compare output"
perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
diff -b $TEMPDIR/pspp.list - << EOF
-1.1 DATA LIST. Reading 1 record from INLINE.
-+--------+------+-------+------+
-|Variable|Record|Columns|Format|
-#========#======#=======#======#
-|N | 1| 1- 1|A1 |
-|A | 1| 2- 3|F2.0 |
-|B | 1| 4- 5|F2.0 |
-|C | 1| 6- 7|F2.0 |
-|D | 1| 8- 9|F2.0 |
-+--------+------+-------+------+
N A B C D
- -- -- -- --
v 1 2 3 4
@@ -110,6 +114,22 @@
X 11.00 12.00 13.00 14.00
Y 16.00 17.00 18.00 19.00
Z 21.00 22.00 23.00 24.00
+v1 v2 v3 v4 v5 v6 v7 v8 v9 v10
+-- -- -- -- -- -- -- -- -- ---
+ 1 2 3 4 5 6 7 8 9 10
+ 4 5 6 7 8 9 10 11 12 13
+CASE_LBL VAR000 VAR001
+-------- -------- --------
+v1 1.00 4.00
+v2 2.00 5.00
+v3 3.00 6.00
+v4 4.00 7.00
+v5 5.00 8.00
+v6 6.00 9.00
+v7 7.00 10.00
+v8 8.00 11.00
+v9 9.00 12.00
+v10 10.00 13.00
EOF
if [ $? -ne 0 ] ; then fail ; fi
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp src/language/stats/flip.c tests/command/fl...,
Ben Pfaff <=