X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Ftests%2Fmoments-test.c;h=af328928abddbff93e5cb6ac59ef955ef4367e0f;hb=9ade26c8349b4434008c46cf09bc7473ec743972;hp=65ce6f02384d56372d45fa4828b085e826851040;hpb=f5c108becd49d78f4898cab11352291f5689d24e;p=pspp-builds.git diff --git a/src/language/tests/moments-test.c b/src/language/tests/moments-test.c index 65ce6f02..af328928 100644 --- a/src/language/tests/moments-test.c +++ b/src/language/tests/moments-test.c @@ -1,32 +1,33 @@ -/* PSPP - computes sample statistics. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. +/* PSPP - a program for statistical analysis. + Copyright (C) 1997-9, 2000, 2010, 2011 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 the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program. If not, see . */ #include -#include -#include "gettext.h" -#include -#include -#include + #include +#include #include -#include "xalloc.h" -#include +#include "language/command.h" +#include "language/lexer/lexer.h" +#include "libpspp/compiler.h" +#include "math/moments.h" + +#include "gl/xalloc.h" + +#include "gettext.h" #define _(msgid) gettext (msgid) static bool @@ -42,7 +43,7 @@ read_values (struct lexer *lexer, double **values, double **weights, size_t *cnt double value = lex_tokval (lexer); double weight = 1.; lex_get (lexer); - if (lex_match (lexer, '*')) + if (lex_match (lexer, T_ASTERISK)) { if (!lex_is_number (lexer)) { @@ -81,12 +82,11 @@ cmd_debug_moments (struct lexer *lexer, struct dataset *ds UNUSED) if (lex_match_id (lexer, "ONEPASS")) two_pass = 0; - if (lex_token (lexer) != '/') + if (lex_token (lexer) != T_SLASH) { - lex_force_match (lexer, '/'); + lex_force_match (lexer, T_SLASH); goto done; } - fprintf (stderr, "%s => ", lex_rest_of_line (lexer)); lex_get (lexer); if (two_pass) @@ -125,7 +125,7 @@ cmd_debug_moments (struct lexer *lexer, struct dataset *ds UNUSED) fprintf (stderr, "W=%.3f", weight); for (i = 0; i < 4; i++) { - fprintf (stderr, " M%d=", (int) i + 1); + fprintf (stderr, " M%zu=", i + 1); if (M[i] == SYSMIS) fprintf (stderr, "sysmis"); else if (fabs (M[i]) <= 0.0005) @@ -135,7 +135,7 @@ cmd_debug_moments (struct lexer *lexer, struct dataset *ds UNUSED) } fprintf (stderr, "\n"); - retval = lex_end_of_command (lexer); + retval = CMD_SUCCESS; done: free (values);