/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-2000, 2009-2012 Free Software Foundation, Inc.
+ Copyright (C) 1997-2000, 2009-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
}
+ /* It would be better to handle Z scores correctly (however we define
+ that) when TEMPORARY is in effect, but in the meantime this at least
+ prevents a use-after-free error. See bug #38786. */
+ if (proc_make_temporary_transformations_permanent (ds))
+ msg (SW, _("DESCRIPTIVES with Z scores ignores TEMPORARY. "
+ "Temporary transformations will be made permanent."));
+
proto = caseproto_create ();
for (i = 0; i < 1 + 2 * z_cnt; i++)
proto = caseproto_add_width (proto, 0);
2.00,500.00,10000.00,1.10,1.10
])
AT_CLEANUP
+
+dnl Ideally DESCRIPTIVES would not make temporary transformations permanent
+dnl as it does now (bug #38786), so these results are imperfect. However,
+dnl this test does verify that DESCRIPTIVES does not crash in this situation
+dnl (as it once did).
+AT_SETUP([DESCRIPTIVES -- Z scores bug with TEMPORARY])
+AT_DATA([descriptives.sps], [dnl
+DATA LIST LIST NOTABLE /id abc.
+BEGIN DATA.
+1 3.5
+2 2.0
+3 2.0
+4 3.5
+5 3.0
+6 4.0
+7 5.0
+END DATA.
+
+TEMPORARY.
+SELECT IF id < 7 .
+
+DESCRIPTIVES /VAR=abc/SAVE.
+LIST.
+])
+AT_CHECK([pspp -O format=csv descriptives.sps], [0], [dnl
+descriptives.sps:15: warning: DESCRIPTIVES: DESCRIPTIVES with Z scores ignores TEMPORARY. Temporary transformations will be made permanent.
+
+Table: Mapping of variables to corresponding Z-scores.
+Source,Target
+abc,Zabc
+
+Table: Valid cases = 6; cases with missing value(s) = 0.
+Variable,N,Mean,Std Dev,Minimum,Maximum
+abc,6,3.00,.84,2.00,4.00
+
+Table: Data List
+id,abc,Zabc
+1.00,3.50,.60
+2.00,2.00,-1.20
+3.00,2.00,-1.20
+4.00,3.50,.60
+5.00,3.00,.00
+6.00,4.00,1.20
+])
+AT_CLEANUP