format for the temporary test file names.
+Tue Jan 18 19:26:59 WST 2005 John Darrington <john@darrington.wattle.id.au>
+
+ * examine.q factor_stats.[ch] get.c pfm-read.c: Plugged numerous
+ memory leaks.
+
Mon Jan 10 14:43:45 WST 2005 John Darrington <john@darrington.wattle.id.au>
* ascii.c cartesian.c casefile.c chart.h devind.c
void box_plot_variables(const struct factor *fctr,
- struct variable **vars, int n_vars,
+ const struct variable **vars, int n_vars,
const struct variable *id
);
multipass_procedure_with_splits (run_examine, &cmd);
if ( totals )
- free(totals);
+ free( totals );
+
+ if ( dependent_vars )
+ free (dependent_vars);
subc_list_double_destroy(&percentile_list);
assert(n_dependent_vars);
totals = xmalloc( sizeof(struct metrics) * n_dependent_vars);
+ memset ( totals, 0, sizeof(struct metrics) * n_dependent_vars);
if ( lex_match(T_BY))
{
output_examine();
- for ( v = 0 ; v < n_dependent_vars ; ++v )
- hsh_destroy(totals[v].ordered_data);
+
+ if ( totals )
+ {
+ int i;
+ for ( i = 0 ; i < n_dependent_vars ; ++i )
+ metrics_destroy(&totals[i]);
+ }
}
void
box_plot_variables(const struct factor *fctr,
- struct variable **vars, int n_vars,
+ const struct variable **vars, int n_vars,
const struct variable *id)
{
box_plot_group(const struct factor *fctr,
const struct variable **vars,
int n_vars,
- const struct variable *id)
+ const struct variable *id UNUSED)
{
int i;
int i;
int j = 1;
-
moments1_calculate (m->moments, &m->n, &m->mean, &m->var,
&m->skewness, &m->kurtosis);
m->trimmed_mean += (m->wvp[k1 + 1]->cc - tc) * m->wvp[k1 + 1]->v.f ;
m->trimmed_mean /= 0.9 * m->n ;
+
}
void
weighted_value_free(struct weighted_value *wv)
{
- struct case_node *cn = wv->case_nos;
+ struct case_node *cn ;
+
+ if ( !wv )
+ return ;
+
+ cn = wv->case_nos;
while(cn)
{
f->id[0] = *id0;
f->id[1] = *id1;
f->m = xmalloc( sizeof ( struct metrics ) * n ) ;
+ memset (f->m, 0, sizeof(struct metrics) * n);
+ f->n_var = n;
return f;
}
+void
+metrics_destroy(struct metrics *m)
+{
+ hsh_destroy(m->ordered_data);
+ hsh_destroy(m->ptile_hash);
+ gsl_histogram_free(m->histogram);
+}
+
void
factor_statistics_free(struct factor_statistics *f)
{
- hsh_destroy(f->m->ordered_data);
- gsl_histogram_free(f->m->histogram);
+
+ int i;
+ for ( i = 0 ; i < f->n_var; ++i )
+ metrics_destroy(&f->m[i]);
free(f->m) ;
free(f);
}
#include "hash.h"
#include "val.h"
+#include <string.h>
#include <gsl/gsl_histogram.h>
#include "subclist.h"
#include "percentiles.h"
};
+struct metrics * metrics_create(void);
+
void metrics_precalc(struct metrics *m);
void metrics_calc(struct metrics *m, const union value *f, double weight,
void metrics_postcalc(struct metrics *m);
+void metrics_destroy(struct metrics *m);
+
+
/* Linked list of case nos */
struct case_node
/* The an array stats for this factor, one for each dependent var */
struct metrics *m;
+ /* The number of dependent variables */
+ int n_var;
};
{
procedure (save_write_case_func, t);
save_trns_free (&t->h);
+ free(t);
return CMD_SUCCESS;
}
else
procedure (export_write_case_func, proc);
export_proc_free (proc);
+ free (proc);
return CMD_SUCCESS;
error:
dict_destroy (dict);
export_proc_free (proc);
+ free (proc);
return CMD_FAILURE;
}
for (i = 0; i < var_cnt; i++)
{
struct variable *v = dict_get_var (d, i);
- int src_fv = *(int *) var_detach_aux (v);
+ int *src_fv = (int *) var_detach_aux (v);
size_t idx;
- if (v->fv != src_fv)
+ if (v->fv != *src_fv)
identity_map = 0;
for (idx = 0; idx < v->nv; idx++)
{
- int src_idx = src_fv + idx;
+ int src_idx = *src_fv + idx;
int dst_idx = v->fv + idx;
assert (map->map[dst_idx] == -1);
map->map[dst_idx] = src_idx;
}
+ free (src_fv);
}
if (identity_map)
msg (ME, _("%s: Closing portable file: %s."),
handle_get_filename (r->fh), strerror (errno));
free (r->trans);
+ free (r->widths);
free (r);
}
+Tue Jan 18 19:25:24 WST 2005 John Darrington <john@darrington.wattle.id.au>
+
+ * Canonicalised (some of) the tests' temp file names to make it
+ easier to recognise valgrind ouput.
+
Sun Jan 9 16:39:08 WST 2005 John Darrington <john@darrington.wattle.id.au>
* bugs/big-input-2.sh Made the test a bit faster
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
printf "\n";
activity="create program"
-cat > $TEMPDIR/large.sps <<EOF
+cat > $TESTFILE <<EOF
DATA LIST FILE='$TEMPDIR/large.dat' /S 1-2 (A) X 3 .
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/large.sps > /dev/null
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE > /dev/null
if [ $? -ne 0 ] ; then fail ; fi
activity="appending to data"
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/large.sps > /dev/null
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE > /dev/null
if [ $? -ne 0 ] ; then fail ; fi
pass;
# This program tests the aggregate procedure
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
+
here=`pwd`;
cd $TEMPDIR
activity="program create"
-cat > $TEMPDIR/test.sps << EOF
+cat > $TESTFILE << EOF
data list notable /x y 1-2.
begin data.
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/test.sps
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="test result"
# This program tests the autorecode command
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
+
here=`pwd`;
cd $TEMPDIR
activity="create program"
-cat > $TEMPDIR/prog.sps <<EOF
+cat > $TESTFILE <<EOF
/* Tries AUTORECODE on some random but similar strings of characters.
data list /x 1-5(a) y 7.
begin data.
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/prog.sps
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="test output"
# This program tests the BEGIN DATA / END DATA commands
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
cd $TEMPDIR
activity="create program"
-cat > $TEMPDIR/prog.sps << EOF_foobar
+cat > $TESTFILE << EOF_foobar
title 'Test BEGIN DATA ... END DATA'.
data list /A B 1-2.
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/prog.sps
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare data"
# This program tests the use of big numbers
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
activity="create program"
-cat > $TEMPDIR/prog.stat <<foobar
+cat > $TESTFILE <<foobar
title 'Test use of big numbers'.
*** Do the portable output.
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii prog.stat
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
# Like the above comments say ...
# This program tests the count transformation
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
cd $TEMPDIR
-cat > $TEMPDIR/count.stat <<EOF
+cat > $TESTFILE <<EOF
title 'Test COUNT transformation'.
* we're going to count the 2s 4s and 1s in the data
if [ $? -ne 0 ] ; then no_result ; fi
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/count.stat
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
# This program tests the DATA LIST input program.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# Create command file.
activity="create program"
-cat > $TEMPDIR/data-list.stat << EOF
+cat > $TESTFILE << EOF
data list list ('|','X') /A B C D.
begin data.
1|23X45|2.03
activity="run program"
-$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii --testing-mode $TEMPDIR/data-list.stat # > $TEMPDIR/errs
+$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii --testing-mode $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
activity="compare output"
# This program tests the ERASE command.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
activity="create program 1"
-cat > $TEMPDIR/foo.sps <<EOF
+cat > $TESTFILE <<EOF
set safer on
erase FILE='foobar'.
# This command must fail
activity="run prog 1"
-$SUPERVISOR $here/../src/pspp $TEMPDIR/foo.sps > /dev/null
+$SUPERVISOR $here/../src/pspp $TESTFILE > /dev/null
if [ $? -eq 0 ] ; then fail ; fi
activity="create program 2"
-cat > $TEMPDIR/foo.sps <<EOF
+cat > $TESTFILE <<EOF
erase FILE='foobar'.
activity="run prog 1"
-$SUPERVISOR $here/../src/pspp $TEMPDIR/foo.sps
+$SUPERVISOR $here/../src/pspp $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
# foobar should now be gone
if [ -f $TEMPDIR/foobar ] ; then fail ; fi
-
-
-
-
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-
pass;
# This program tests the EXTREME subcommand of the EXAMINE command.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
cd $TEMPDIR
activity="create program"
-cat > $TEMPDIR/out.stat <<EOF
+cat > $TESTFILE <<EOF
data list free /v1 w
begin data.
1 1
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare results"
# a few cases
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
cd $TEMPDIR
activity="create program"
-cat > $TEMPDIR/out.stat <<EOF
+cat > $TESTFILE <<EOF
DATA LIST LIST /x *.
BEGIN DATA.
2.00
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
# This program tests the EXAMINE command.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
cd $TEMPDIR
activity="create program"
-cat > $TEMPDIR/out.stat <<EOF
+cat > $TESTFILE <<EOF
DATA LIST LIST /quality * w * brand * .
BEGIN DATA
3 1 1
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
# NOTE: In the following data: Only the extreme values have been checked
# This program tests the FILE LABEL and DOCUMENT commands
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests ....
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the flip command
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the IMPORT and EXPORT commands
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
cd $TEMPDIR
activity="create program"
-cat > $TEMPDIR/prog.stat <<EOF
+cat > $TESTFILE <<EOF
DATA LIST LIST /x * y *.
BEGIN DATA.
1 2
activity="run program"
-$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/prog.stat
+$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare output"
# This program tests the LAG function
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the LIST command.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the LOOP command
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests that the ONEWAY anova command works OK when there is missing data
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
cd $TEMPDIR
activity="create program"
-cat > $TEMPDIR/out.stat <<EOF
+cat > $TESTFILE <<EOF
DATA LIST LIST /v1 * v2 * dep * vn *.
BEGIN DATA
. . 1 4
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="copy output"
if [ $? -ne 0 ] ; then no_result ; fi
activity="create program 2"
-cat > $TEMPDIR/out.stat <<EOF
+cat > $TESTFILE <<EOF
DATA LIST LIST /v1 * v2 * dep * vn * .
BEGIN DATA
4 . 1 2
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program 2"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare outputs"
# Now try a missing dependent variable
# Everything depends upon it, so it should behave as if LISTWISE were set
activity="create program 3"
-cat > $TEMPDIR/out.stat <<EOF
+cat > $TESTFILE <<EOF
DATA LIST LIST /v1 * v2 * dep * vn * .
BEGIN DATA
4 2 . 2
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program 3"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare outputs"
# when SPLIT FILE is active
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests that the ONEWAY anova command works OK
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the PERMISSIONS command
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the PRINT transformation
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the SAMPLE function
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the sort command
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the split file command
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the SYSFILE INFO command
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# when a single value in the independent variable is given.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
cd $TEMPDIR
activity="create program"
-cat > $TEMPDIR/out.stat <<EOF
+cat > $TESTFILE <<EOF
data list list /indep * dep *.
begin data.
1 6
activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
# when there are per analysis missing values involved.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# when there are listwise missing values involved.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests that the T-TEST /TESTVAL command works OK
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests that the T-TEST /GROUPS command works
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# when ANALYSIS missing values are involved
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# when LISTWISE missing values are involved
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# when there is per ANALYSIS missing data involved.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# when there is listwise missing data involved.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests that the T-TEST /PAIRS command works OK
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests that tab characters can be used in string input
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# where the data is weighted towards the centre
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests USE, just to make sure that USE ALL is accepted silently.
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
# This program tests the WEIGHT command
TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
here=`pwd`;
cd $TEMPDIR
activity="create program"
-cat > $TEMPDIR/weight.stat <<EOF
+cat > $TESTFILE << EOF
data list file='$top_srcdir/tests/weighting.data'/AVAR 1-5 BVAR 6-10.
weight by BVAR.
activity="run program"
-$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/weight.stat
+$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare results"