X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fdata%2Fdatasheet-test.c;h=e3dad3b32c8a9b826656c38e32dc1a278cc91671;hb=7e0d00ad64b1957062f6f06c119e8808b9e6b727;hp=a9f4bf2fb27f43b525fb764c07fb14c706d111d6;hpb=a40c445019ddfed3cdd348c2ce8026e467563c73;p=pspp diff --git a/tests/data/datasheet-test.c b/tests/data/datasheet-test.c index a9f4bf2fb2..e3dad3b32c 100644 --- a/tests/data/datasheet-test.c +++ b/tests/data/datasheet-test.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010, 2014 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 @@ -19,7 +19,9 @@ #include #include +#include #include +#include #include #include @@ -152,9 +154,10 @@ check_datasheet_casereader (struct mc *mc, struct casereader *reader, { if (width == 0) mc_error (mc, "element %zu,%zu (of %zu,%zu) differs: " - "%g != %g", + "%.*g != %.*g", row, col, n_rows, n_columns, - case_num_idx (c, col), array[row][col].f); + DBL_DIG + 1, case_num_idx (c, col), + DBL_DIG + 1, array[row][col].f); else mc_error (mc, "element %zu,%zu (of %zu,%zu) differs: " "'%.*s' != '%.*s'", @@ -216,8 +219,8 @@ check_datasheet (struct mc *mc, struct datasheet *ds, { if (width == 0) mc_error (mc, "element %zu,%zu (of %zu,%zu) differs: " - "%g != %g", row, col, n_rows, n_columns, - v.f, av->f); + "%.*g != %.*g", row, col, n_rows, n_columns, + DBL_DIG + 1, v.f, DBL_DIG + 1, av->f); else mc_error (mc, "element %zu,%zu (of %zu,%zu) differs: " "'%.*s' != '%.*s'", @@ -404,7 +407,7 @@ value_from_param (union value *value, int width, unsigned int idx) else { unsigned int hash = hash_int (idx, 0); - char *string = value_str_rw (value, width); + uint8_t *string = value_str_rw (value, width); int offset; assert (width < 32); @@ -423,9 +426,12 @@ datasheet_mc_init (struct mc *mc) if (params->backing_rows == 0 && params->n_backing_cols == 0) { /* Create unbacked datasheet. */ + struct caseproto *proto; ds = datasheet_create (NULL); mc_name_operation (mc, "empty datasheet"); - check_datasheet (mc, ds, NULL, 0, caseproto_create ()); + proto = caseproto_create (); + check_datasheet (mc, ds, NULL, 0, proto); + caseproto_unref (proto); } else { @@ -481,9 +487,9 @@ struct resize_cb_aux }; static void -resize_cb (const union value *old_value, union value *new_value, void *aux_) +resize_cb (const union value *old_value, union value *new_value, const void *aux_) { - struct resize_cb_aux *aux = aux_; + const struct resize_cb_aux *aux = aux_; value_from_param (new_value, aux->new_width, value_hash (old_value, aux->old_width, 0)); @@ -747,7 +753,7 @@ enum N_DATASHEET_OPTIONS }; -static struct argv_option datasheet_argv_options[N_DATASHEET_OPTIONS] = +static const struct argv_option datasheet_argv_options[N_DATASHEET_OPTIONS] = { {"max-rows", 0, required_argument, OPT_MAX_ROWS}, {"max-columns", 0, required_argument, OPT_MAX_COLUMNS}, @@ -889,7 +895,7 @@ main (int argc, char *argv[]) params.n_widths = 3; params.next_value = 1; - /* Parse comand line. */ + /* Parse command line. */ parser = argv_parser_create (); options = mc_options_create (); mc_options_register_argv_parser (options, parser);