projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NPAR TESTS: Fix two test failures.
[pspp-builds.git]
/
src
/
language
/
stats
/
npar.c
diff --git
a/src/language/stats/npar.c
b/src/language/stats/npar.c
index b3a24dce77eace0e2a5e5f0359c04c3329fabe39..3f2bae298ef45669cd6331f896c160d0988ff465 100644
(file)
--- a/
src/language/stats/npar.c
+++ b/
src/language/stats/npar.c
@@
-158,7
+158,7
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
memset (npt->a_statistics, 0, sizeof npt->a_statistics);
for (;;)
{
memset (npt->a_statistics, 0, sizeof npt->a_statistics);
for (;;)
{
- if (lex_match_
hyphenated_wor
d (lexer, "COCHRAN"))
+ if (lex_match_
i
d (lexer, "COCHRAN"))
{
npt->cochran++;
switch (npar_cochran (lexer, ds, nps))
{
npt->cochran++;
switch (npar_cochran (lexer, ds, nps))
@@
-174,7
+174,7
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
NOT_REACHED ();
}
}
NOT_REACHED ();
}
}
- else if (lex_match_
hyphenated_wor
d (lexer, "FRIEDMAN"))
+ else if (lex_match_
i
d (lexer, "FRIEDMAN"))
{
npt->friedman++;
switch (npar_friedman (lexer, ds, nps))
{
npt->friedman++;
switch (npar_friedman (lexer, ds, nps))
@@
-190,7
+190,7
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
NOT_REACHED ();
}
}
NOT_REACHED ();
}
}
- else if (lex_match_
hyphenated_wor
d (lexer, "KENDALL"))
+ else if (lex_match_
i
d (lexer, "KENDALL"))
{
npt->kendall++;
switch (npar_kendall (lexer, ds, nps))
{
npt->kendall++;
switch (npar_kendall (lexer, ds, nps))
@@
-206,7
+206,7
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
NOT_REACHED ();
}
}
NOT_REACHED ();
}
}
- else if (lex_match_
hyphenated_wor
d (lexer, "RUNS"))
+ else if (lex_match_
i
d (lexer, "RUNS"))
{
npt->runs++;
switch (npar_runs (lexer, ds, nps))
{
npt->runs++;
switch (npar_runs (lexer, ds, nps))
@@
-222,7
+222,7
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
NOT_REACHED ();
}
}
NOT_REACHED ();
}
}
- else if (lex_match_
hyphenated_wor
d (lexer, "CHISQUARE"))
+ else if (lex_match_
i
d (lexer, "CHISQUARE"))
{
lex_match (lexer, T_EQUALS);
npt->chisquare++;
{
lex_match (lexer, T_EQUALS);
npt->chisquare++;
@@
-235,11
+235,13
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
case 2:
lex_error (lexer, NULL);
goto lossage;
case 2:
lex_error (lexer, NULL);
goto lossage;
+ case 3:
+ continue;
default:
NOT_REACHED ();
}
}
default:
NOT_REACHED ();
}
}
- else if (lex_match_
hyphenated_wor
d (lexer, "BINOMIAL"))
+ else if (lex_match_
i
d (lexer, "BINOMIAL"))
{
lex_match (lexer, T_EQUALS);
npt->binomial++;
{
lex_match (lexer, T_EQUALS);
npt->binomial++;
@@
-277,7
+279,7
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
else if (lex_match_hyphenated_word (lexer, "M-W") ||
lex_match_hyphenated_word (lexer, "MANN-WHITNEY"))
{
else if (lex_match_hyphenated_word (lexer, "M-W") ||
lex_match_hyphenated_word (lexer, "MANN-WHITNEY"))
{
- lex_match (lexer,
'='
);
+ lex_match (lexer,
T_EQUALS
);
npt->mann_whitney++;
switch (npar_mann_whitney (lexer, ds, nps))
{
npt->mann_whitney++;
switch (npar_mann_whitney (lexer, ds, nps))
{
@@
-292,7
+294,7
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
NOT_REACHED ();
}
}
NOT_REACHED ();
}
}
- else if (lex_match_
hyphenated_wor
d (lexer, "WILCOXON"))
+ else if (lex_match_
i
d (lexer, "WILCOXON"))
{
lex_match (lexer, T_EQUALS);
npt->wilcoxon++;
{
lex_match (lexer, T_EQUALS);
npt->wilcoxon++;
@@
-309,7
+311,7
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
NOT_REACHED ();
}
}
NOT_REACHED ();
}
}
- else if (lex_match_
hyphenated_wor
d (lexer, "SIGN"))
+ else if (lex_match_
i
d (lexer, "SIGN"))
{
lex_match (lexer, T_EQUALS);
npt->sign++;
{
lex_match (lexer, T_EQUALS);
npt->sign++;
@@
-326,7
+328,7
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
NOT_REACHED ();
}
}
NOT_REACHED ();
}
}
- else if (lex_match_
hyphenated_wor
d (lexer, "MISSING"))
+ else if (lex_match_
i
d (lexer, "MISSING"))
{
lex_match (lexer, T_EQUALS);
npt->missing++;
{
lex_match (lexer, T_EQUALS);
npt->missing++;
@@
-337,13
+339,13
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
}
while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD)
{
}
while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD)
{
- if (lex_match_
hyphenated_wor
d (lexer, "ANALYSIS"))
+ if (lex_match_
i
d (lexer, "ANALYSIS"))
npt->miss = MISS_ANALYSIS;
npt->miss = MISS_ANALYSIS;
- else if (lex_match_
hyphenated_wor
d (lexer, "LISTWISE"))
+ else if (lex_match_
i
d (lexer, "LISTWISE"))
npt->miss = MISS_LISTWISE;
npt->miss = MISS_LISTWISE;
- else if (lex_match_
hyphenated_wor
d (lexer, "INCLUDE"))
+ else if (lex_match_
i
d (lexer, "INCLUDE"))
nps->filter = MV_SYSTEM;
nps->filter = MV_SYSTEM;
- else if (lex_match_
hyphenated_wor
d (lexer, "EXCLUDE"))
+ else if (lex_match_
i
d (lexer, "EXCLUDE"))
nps->filter = MV_ANY;
else
{
nps->filter = MV_ANY;
else
{
@@
-353,7
+355,7
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
lex_match (lexer, T_COMMA);
}
}
lex_match (lexer, T_COMMA);
}
}
- else if (lex_match_
hyphenated_wor
d (lexer, "METHOD"))
+ else if (lex_match_
i
d (lexer, "METHOD"))
{
lex_match (lexer, T_EQUALS);
npt->method++;
{
lex_match (lexer, T_EQUALS);
npt->method++;
@@
-375,15
+377,15
@@
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests
NOT_REACHED ();
}
}
NOT_REACHED ();
}
}
- else if (lex_match_
hyphenated_wor
d (lexer, "STATISTICS"))
+ else if (lex_match_
i
d (lexer, "STATISTICS"))
{
lex_match (lexer, T_EQUALS);
npt->statistics++;
while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD)
{
{
lex_match (lexer, T_EQUALS);
npt->statistics++;
while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD)
{
- if (lex_match_
hyphenated_wor
d (lexer, "DESCRIPTIVES"))
+ if (lex_match_
i
d (lexer, "DESCRIPTIVES"))
npt->a_statistics[NPAR_ST_DESCRIPTIVES] = 1;
npt->a_statistics[NPAR_ST_DESCRIPTIVES] = 1;
- else if (lex_match_
hyphenated_wor
d (lexer, "QUARTILES"))
+ else if (lex_match_
i
d (lexer, "QUARTILES"))
npt->a_statistics[NPAR_ST_QUARTILES] = 1;
else if (lex_match (lexer, T_ALL))
npt->a_statistics[NPAR_ST_ALL] = 1;
npt->a_statistics[NPAR_ST_QUARTILES] = 1;
else if (lex_match (lexer, T_ALL))
npt->a_statistics[NPAR_ST_ALL] = 1;
@@
-574,7
+576,7
@@
npar_runs (struct lexer *lexer, struct dataset *ds,
nt->execute = runs_execute;
nt->insert_variables = one_sample_insert_variables;
nt->execute = runs_execute;
nt->insert_variables = one_sample_insert_variables;
- if ( lex_force_match (lexer,
'('
) )
+ if ( lex_force_match (lexer,
T_LPAREN
) )
{
if ( lex_match_id (lexer, "MEAN"))
{
{
if ( lex_match_id (lexer, "MEAN"))
{
@@
-600,8
+602,8
@@
npar_runs (struct lexer *lexer, struct dataset *ds,
return 0;
}
return 0;
}
- lex_force_match (lexer,
')'
);
- lex_force_match (lexer,
'='
);
+ lex_force_match (lexer,
T_RPAREN
);
+ lex_force_match (lexer,
T_EQUALS
);
if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&tp->vars, &tp->n_vars,
PV_NO_SCRATCH | PV_NO_DUPLICATE | PV_NUMERIC))
if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&tp->vars, &tp->n_vars,
PV_NO_SCRATCH | PV_NO_DUPLICATE | PV_NUMERIC))
@@
-632,7
+634,7
@@
npar_friedman (struct lexer *lexer, struct dataset *ds,
nt->execute = friedman_execute;
nt->insert_variables = one_sample_insert_variables;
nt->execute = friedman_execute;
nt->insert_variables = one_sample_insert_variables;
- lex_match (lexer,
'='
);
+ lex_match (lexer,
T_EQUALS
);
if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&ost->vars, &ost->n_vars,
if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&ost->vars, &ost->n_vars,
@@
-663,7
+665,7
@@
npar_kendall (struct lexer *lexer, struct dataset *ds,
nt->execute = friedman_execute;
nt->insert_variables = one_sample_insert_variables;
nt->execute = friedman_execute;
nt->insert_variables = one_sample_insert_variables;
- lex_match (lexer,
'='
);
+ lex_match (lexer,
T_EQUALS
);
if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&ost->vars, &ost->n_vars,
if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&ost->vars, &ost->n_vars,
@@
-693,7
+695,7
@@
npar_cochran (struct lexer *lexer, struct dataset *ds,
nt->execute = cochran_execute;
nt->insert_variables = one_sample_insert_variables;
nt->execute = cochran_execute;
nt->insert_variables = one_sample_insert_variables;
- lex_match (lexer,
'='
);
+ lex_match (lexer,
T_EQUALS
);
if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&ft->vars, &ft->n_vars,
if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&ft->vars, &ft->n_vars,
@@
-720,7
+722,7
@@
npar_chisquare (struct lexer *lexer, struct dataset *ds,
struct chisquare_test *cstp = pool_alloc (specs->pool, sizeof (*cstp));
struct one_sample_test *tp = &cstp->parent;
struct npar_test *nt = &tp->parent;
struct chisquare_test *cstp = pool_alloc (specs->pool, sizeof (*cstp));
struct one_sample_test *tp = &cstp->parent;
struct npar_test *nt = &tp->parent;
-
+ int retval = 1;
nt->execute = chisquare_execute;
nt->insert_variables = one_sample_insert_variables;
nt->execute = chisquare_execute;
nt->insert_variables = one_sample_insert_variables;
@@
-772,7
+774,7
@@
npar_chisquare (struct lexer *lexer, struct dataset *ds,
n = 1;
f = lex_number (lexer);
lex_get (lexer);
n = 1;
f = lex_number (lexer);
lex_get (lexer);
- if ( lex_match (lexer,
'*'
))
+ if ( lex_match (lexer,
T_ASTERISK
))
{
n = f;
f = lex_number (lexer);
{
n = f;
f = lex_number (lexer);
@@
-794,7
+796,7
@@
npar_chisquare (struct lexer *lexer, struct dataset *ds,
}
}
else
}
}
else
-
lex_put_back (lexer, T_SLASH)
;
+
retval = 3
;
}
if ( cstp->ranged && cstp->n_expected > 0 &&
}
if ( cstp->ranged && cstp->n_expected > 0 &&
@@
-815,7
+817,7
@@
npar_chisquare (struct lexer *lexer, struct dataset *ds,
specs->test[specs->n_tests - 1] = nt;
specs->test[specs->n_tests - 1] = nt;
- return
1
;
+ return
retval
;
}
}
@@
-826,6
+828,7
@@
npar_binomial (struct lexer *lexer, struct dataset *ds,
struct binomial_test *btp = pool_alloc (specs->pool, sizeof (*btp));
struct one_sample_test *tp = &btp->parent;
struct npar_test *nt = &tp->parent;
struct binomial_test *btp = pool_alloc (specs->pool, sizeof (*btp));
struct one_sample_test *tp = &btp->parent;
struct npar_test *nt = &tp->parent;
+ bool equals;
nt->execute = binomial_execute;
nt->insert_variables = one_sample_insert_variables;
nt->execute = binomial_execute;
nt->insert_variables = one_sample_insert_variables;
@@
-836,6
+839,7
@@
npar_binomial (struct lexer *lexer, struct dataset *ds,
if ( lex_match (lexer, T_LPAREN) )
{
if ( lex_match (lexer, T_LPAREN) )
{
+ equals = false;
if ( lex_force_num (lexer) )
{
btp->p = lex_number (lexer);
if ( lex_force_num (lexer) )
{
btp->p = lex_number (lexer);
@@
-846,10
+850,9
@@
npar_binomial (struct lexer *lexer, struct dataset *ds,
return 0;
}
else
return 0;
}
else
- /* Kludge: q2c swallows the '=' so put it back here */
- lex_put_back (lexer, T_EQUALS);
+ equals = true;
- if (lex_match (lexer, T_EQUALS) )
+ if (
equals ||
lex_match (lexer, T_EQUALS) )
{
if (parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&tp->vars, &tp->n_vars,
{
if (parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&tp->vars, &tp->n_vars,