From 649c202d57d7d5d8bb87be5b72839cd56ca4ca0b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 23 Aug 2014 17:19:38 -0700 Subject: [PATCH] SYSFILE INFO: Improve output formatting by using nested tables. --- NEWS | 4 + perl-module/t/Pspp.t | 57 +- src/language/dictionary/sys-file-info.c | 382 ++++++----- tests/data/por-file.at | 47 +- tests/data/sys-file-reader.at | 644 +++++++++--------- tests/data/sys-file.at | 155 ++--- tests/language/data-io/get-data-psql.at | 129 +--- .../language/data-io/get-data-spreadsheet.at | 73 +- tests/language/data-io/list.at | 7 +- tests/language/dictionary/attributes.at | 29 +- tests/language/dictionary/formats.at | 42 +- tests/language/dictionary/missing-values.at | 156 ++--- tests/language/dictionary/sys-file-info.at | 20 +- tests/language/dictionary/value-labels.at | 54 +- tests/language/dictionary/variable-display.at | 32 +- tests/language/stats/autorecode.at | 27 +- tests/language/stats/rank.at | 78 +-- tests/perl-module.at | 235 +++---- 18 files changed, 950 insertions(+), 1221 deletions(-) diff --git a/NEWS b/NEWS index 2255627c28..c2bf42b6dd 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,10 @@ See the end for copying conditions. Please send PSPP bug reports to bug-gnu-pspp@gnu.org. +Changes since 0.8.3.1: + + * Formatting of SYSFILE INFO output was made easier to read. + Changes from 0.8.3 to 0.8.3.1: * Fixed a bug where planned comparisons in oneway anova did not correctly diff --git a/perl-module/t/Pspp.t b/perl-module/t/Pspp.t index 495064174e..3f8a711a34 100644 --- a/perl-module/t/Pspp.t +++ b/perl-module/t/Pspp.t @@ -175,15 +175,9 @@ sub run_pspp_syntax_cmp DISPLAY DOCUMENTS. LIST. SYNTAX -Variable,Description,,Position -id,Format: F2.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -name,Format: A20,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 20,, +Variable,Description,Position +id,Format: F2.0,1 +name,Format: A20,2 File label: This is the file label @@ -249,30 +243,27 @@ RESULT GET FILE='$tempfile'. DISPLAY DICTIONARY. SYNTAX -Variable,Description,,Position -integer,Label: My Integer,,1 -,Format: F8.0,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,Missing Values: 9; 99,, -,0,Zero, -,1,Unity, -,2,Duality, -string,Label: My String,,2 -,Format: A8,, -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -,"Missing Values: ""this ""; ""that """,, -,xx ,foo, -,yy ,bar, -longstring,Label: My Long String,,3 -,Format: A9,, -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 9,, -,xxx ,xfoo, +Variable,Description,Position +integer,"Label: My Integer +Format: F8.0 +Missing Values: 9; 99 + +Value,Label +0,Zero +1,Unity +2,Duality",1 +string,"Label: My String +Format: A8 +Missing Values: ""this ""; ""that "" + +Value,Label +xx ,foo +yy ,bar",2 +longstring,"Label: My Long String +Format: A9 + +Value,Label +xxx ,xfoo",3 RESULT } diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index f96fa167a5..b9e0a85c48 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -45,8 +45,10 @@ #include "libpspp/string-array.h" #include "output/tab.h" #include "output/text-item.h" +#include "output/table-item.h" #include "gl/localcharset.h" +#include "gl/intprops.h" #include "gl/minmax.h" #include "gl/xalloc.h" @@ -63,12 +65,16 @@ enum DF_MISSING_VALUES = 1 << 4, DF_AT_ATTRIBUTES = 1 << 5, /* Attributes whose names begin with @. */ DF_ATTRIBUTES = 1 << 6, /* All other attributes. */ - DF_MISC = 1 << 7, - DF_ALL = (1 << 8) - 1 + DF_MEASURE = 1 << 7, + DF_ROLE = 1 << 8, + DF_ALIGNMENT = 1 << 9, + DF_WIDTH = 1 << 10, + DF_ALL = (1 << 11) - 1 }; -static int describe_variable (const struct variable *v, struct tab_table *t, - int r, int pc, int flags); +static unsigned int dict_display_mask (const struct dictionary *); + +static struct table *describe_variable (const struct variable *v, int flags); static void report_encodings (const struct file_handle *, const struct sfm_reader *); @@ -84,6 +90,7 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) struct casereader *reader; struct sfm_read_info info; char *encoding; + struct table *table; int r, i; h = NULL; @@ -212,22 +219,20 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) tab_submit (t); - t = tab_create (4, 1 + 2 * dict_get_var_cnt (d)); + t = tab_create (3, 1); tab_headers (t, 0, 0, 1, 0); tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Variable")); - tab_joint_text (t, 1, 0, 2, 0, TAB_LEFT | TAT_TITLE, _("Description")); - tab_text (t, 3, 0, TAB_LEFT | TAT_TITLE, _("Position")); - tab_hline (t, TAL_2, 0, 3, 1); - for (r = 1, i = 0; i < dict_get_var_cnt (d); i++) - r = describe_variable (dict_get_var (d, i), t, r, 3, - DF_ALL & ~DF_AT_ATTRIBUTES); + tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Description")); + tab_text (t, 2, 0, TAB_LEFT | TAT_TITLE, _("Position")); + tab_hline (t, TAL_2, 0, 2, 1); - tab_box (t, TAL_1, TAL_1, -1, -1, 0, 0, 3, r); - tab_vline (t, TAL_1, 1, 0, r); - tab_vline (t, TAL_1, 3, 0, r); + table = &t->table; + for (i = 0; i < dict_get_var_cnt (d); i++) + table = table_vpaste (table, + describe_variable (dict_get_var (d, i), + DF_ALL & ~DF_AT_ATTRIBUTES)); - tab_resize (t, -1, r); - tab_submit (t); + table_item_submit (table_item_create (table, NULL /* XXX */)); dict_destroy (d); @@ -306,16 +311,18 @@ cmd_display (struct lexer *lexer, struct dataset *ds) {"LABELS", DF_DICT_INDEX | DF_VARIABLE_LABELS}, {"NAMES", 0}, {"VARIABLES", - DF_DICT_INDEX | DF_FORMATS | DF_MISSING_VALUES | DF_MISC}, + DF_DICT_INDEX | DF_FORMATS | DF_MISSING_VALUES + | DF_MEASURE | DF_ROLE | DF_ALIGNMENT | DF_WIDTH}, {NULL, 0}, }; const struct subcommand *sbc; + struct dictionary *dict = dataset_dict (ds); flags = 0; for (sbc = subcommands; sbc->name != NULL; sbc++) if (lex_match_id (lexer, sbc->name)) { - flags = sbc->flags; + flags = sbc->flags & dict_display_mask (dict); break; } @@ -325,15 +332,14 @@ cmd_display (struct lexer *lexer, struct dataset *ds) if (lex_token (lexer) != T_ENDCMD) { - if (!parse_variables_const (lexer, dataset_dict (ds), &vl, &n, - PV_NONE)) + if (!parse_variables_const (lexer, dict, &vl, &n, PV_NONE)) { free (vl); return CMD_FAILURE; } } else - dict_get_vars (dataset_dict (ds), &vl, &n, 0); + dict_get_vars (dict, &vl, &n, 0); } if (n > 0) @@ -381,39 +387,53 @@ display_documents (const struct dictionary *dict) } } +static int +count_columns (int flags) +{ + int nc = 1; + if (flags & ~DF_DICT_INDEX) + nc++; + if (flags & DF_DICT_INDEX) + nc++; + + return nc; +} + +static int +position_column (int flags) +{ + int pc = 1; + if (flags & ~DF_DICT_INDEX) + pc++; + return pc; +} + static void display_variables (const struct variable **vl, size_t n, int flags) { struct tab_table *t; - int nc; /* Number of columns. */ - int pc; /* `Position column' */ - int r; /* Current row. */ + struct table *table; size_t i; + int nc; - /* One column for the name, - two columns for general description, - one column for dictionary index. */ - nc = 1; - if (flags & ~DF_DICT_INDEX) - nc += 2; - pc = nc; - if (flags & DF_DICT_INDEX) - nc++; - - t = tab_create (nc, n + 5); + nc = count_columns (flags); + t = tab_create (nc, 1); tab_headers (t, 0, 0, 1, 0); tab_hline (t, TAL_2, 0, nc - 1, 1); tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Variable")); if (flags & ~DF_DICT_INDEX) - tab_joint_text (t, 1, 0, 2, 0, TAB_LEFT | TAT_TITLE, - (flags & ~(DF_DICT_INDEX | DF_VARIABLE_LABELS) - ? _("Description") : _("Label"))); + tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, + (flags & ~(DF_DICT_INDEX | DF_VARIABLE_LABELS) + ? _("Description") : _("Label"))); if (flags & DF_DICT_INDEX) - tab_text (t, pc, 0, TAB_LEFT | TAT_TITLE, _("Position")); + tab_text (t, position_column (flags), 0, TAB_LEFT | TAT_TITLE, + _("Position")); - r = 1; + table = &t->table; for (i = 0; i < n; i++) - r = describe_variable (vl[i], t, r, pc, flags); + table = table_vpaste (table, describe_variable (vl[i], flags)); + +#if 0 tab_hline (t, flags & ~DF_DICT_INDEX ? TAL_2 : TAL_1, 0, nc - 1, 1); if (flags) { @@ -422,8 +442,8 @@ display_variables (const struct variable **vl, size_t n, int flags) } if (flags & ~DF_DICT_INDEX) tab_vline (t, TAL_1, nc - 1, 0, r - 1); - tab_resize (t, -1, r); - tab_submit (t); +#endif + table_item_submit (table_item_create (table, NULL /* XXX */)); } static bool @@ -447,13 +467,21 @@ count_attributes (const struct attrset *set, int flags) return n_attrs; } -static void -display_attributes (struct tab_table *t, const struct attrset *set, int flags, - int c, int r) +static struct table * +describe_attributes (const struct attrset *set, int flags) { struct attribute **attrs; + struct tab_table *t; size_t n_attrs; size_t i; + int r = 1; + + t = tab_create (2, 1 + count_attributes (set, flags)); + tab_headers (t, 0, 0, 1, 0); + tab_box (t, TAL_1, TAL_1, -1, TAL_1, 0, 0, tab_nc (t) - 1, tab_nr (t) - 1); + tab_hline (t, TAL_1, 0, 1, 1); + tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Attribute")); + tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Value")); n_attrs = attrset_count (set); attrs = attrset_sorted (set); @@ -471,78 +499,76 @@ display_attributes (struct tab_table *t, const struct attrset *set, int flags, for (j = 0; j < n_values; j++) { if (n_values > 1) - tab_text_format (t, c, r, TAB_LEFT, "%s[%zu]", name, j + 1); + tab_text_format (t, 0, r, TAB_LEFT, "%s[%zu]", name, j + 1); else - tab_text (t, c, r, TAB_LEFT, name); - tab_text (t, c + 1, r, TAB_LEFT, attribute_get_value (attr, j)); + tab_text (t, 0, r, TAB_LEFT, name); + tab_text (t, 1, r, TAB_LEFT, attribute_get_value (attr, j)); r++; } } free (attrs); + + return &t->table; } static void display_data_file_attributes (struct attrset *set, int flags) { - struct tab_table *t; - size_t n_attrs; + if (count_attributes (set, flags)) + table_item_submit (table_item_create (describe_attributes (set, flags), + _("Custom data file attributes."))); +} - n_attrs = count_attributes (set, flags); - if (!n_attrs) - return; +static struct table * +describe_value_labels (const struct variable *var) +{ + const struct val_labs *val_labs = var_get_value_labels (var); + size_t n_labels = val_labs_count (val_labs); + const struct val_lab **labels; + struct tab_table *t; + size_t i; - t = tab_create (2, n_attrs + 1); - tab_headers (t, 0, 0, 1, 0); + t = tab_create (2, n_labels + 1); tab_box (t, TAL_1, TAL_1, -1, TAL_1, 0, 0, tab_nc (t) - 1, tab_nr (t) - 1); - tab_hline (t, TAL_2, 0, 1, 1); - tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Attribute")); - tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Value")); - display_attributes (t, set, flags, 0, 1); - tab_title (t, "Custom data file attributes."); - tab_submit (t); + + tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Value")); + tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Label")); + + tab_hline (t, TAL_1, 0, 1, 1); + tab_vline (t, TAL_1, 1, 0, n_labels); + + labels = val_labs_sorted (val_labs); + for (i = 0; i < n_labels; i++) + { + const struct val_lab *vl = labels[i]; + + tab_value (t, 0, i + 1, TAB_NONE, &vl->value, var, NULL); + tab_text (t, 1, i + 1, TAB_LEFT, val_lab_get_escaped_label (vl)); + } + free (labels); + + return &t->table; } /* Puts a description of variable V into table T starting at row R. The variable will be described in the format given by FLAGS. Returns the next row available for use in the table. */ -static int -describe_variable (const struct variable *v, struct tab_table *t, int r, - int pc, int flags) +static struct table * +describe_variable (const struct variable *v, int flags) { - size_t n_attrs = 0; - int need_rows; - - /* Make sure that enough rows are allocated. */ - need_rows = 1; - if (flags & ~(DF_DICT_INDEX | DF_VARIABLE_LABELS)) - need_rows += 16; - if (flags & DF_VALUE_LABELS) - need_rows += val_labs_count (var_get_value_labels (v)); - if (flags & (DF_ATTRIBUTES | DF_AT_ATTRIBUTES)) - { - n_attrs = count_attributes (var_get_attributes (v), flags); - need_rows += n_attrs; - } - if (r + need_rows > tab_nr (t)) - { - int nr = MAX (r + need_rows, tab_nr (t) * 2); - tab_realloc (t, -1, nr); - } + struct table *table; + struct string s; - /* Put the name, var label, and position into the first row. */ - tab_text (t, 0, r, TAB_LEFT, var_get_name (v)); - if (flags & DF_DICT_INDEX) - tab_text_format (t, pc, r, 0, "%zu", var_get_dict_index (v) + 1); + ds_init_empty (&s); + /* Variable label. */ if (flags & DF_VARIABLE_LABELS && var_has_label (v)) { if (flags & ~(DF_DICT_INDEX | DF_VARIABLE_LABELS)) - tab_joint_text_format (t, 1, r, 2, r, TAB_LEFT, - _("Label: %s"), var_get_label (v)); + ds_put_format (&s, _("Label: %s\n"), var_get_label (v)); else - tab_joint_text (t, 1, r, 2, r, TAB_LEFT, var_get_label (v)); - r++; + ds_put_format (&s, "%s\n", var_get_label (v)); } /* Print/write format, or print and write formats. */ @@ -550,77 +576,54 @@ describe_variable (const struct variable *v, struct tab_table *t, int r, { const struct fmt_spec *print = var_get_print_format (v); const struct fmt_spec *write = var_get_write_format (v); + char str[FMT_STRING_LEN_MAX + 1]; if (fmt_equal (print, write)) - { - char str[FMT_STRING_LEN_MAX + 1]; - tab_joint_text_format (t, 1, r, 2, r, TAB_LEFT, - _("Format: %s"), fmt_to_string (print, str)); - r++; - } + ds_put_format (&s, _("Format: %s\n"), fmt_to_string (print, str)); else { - char str[FMT_STRING_LEN_MAX + 1]; - tab_joint_text_format (t, 1, r, 2, r, TAB_LEFT, - _("Print Format: %s"), - fmt_to_string (print, str)); - r++; - tab_joint_text_format (t, 1, r, 2, r, TAB_LEFT, - _("Write Format: %s"), - fmt_to_string (write, str)); - r++; + ds_put_format (&s, _("Print Format: %s\n"), + fmt_to_string (print, str)); + ds_put_format (&s, _("Write Format: %s\n"), + fmt_to_string (write, str)); } } - + /* Measurement level, role, display width, alignment. */ - if (flags & DF_MISC) - { - enum var_role role = var_get_role (v); + if (flags & DF_MEASURE) + ds_put_format (&s, _("Measure: %s\n"), + measure_to_string (var_get_measure (v))); - tab_joint_text_format (t, 1, r, 2, r, TAB_LEFT, - _("Measure: %s"), - measure_to_string (var_get_measure (v))); - r++; + if (flags & DF_ROLE) + ds_put_format (&s, _("Role: %s\n"), var_role_to_string (var_get_role (v))); - if (role != ROLE_INPUT) - { - tab_joint_text_format (t, 1, r, 2, r, TAB_LEFT, - _("Role: %s"), var_role_to_string (role)); - r++; - } - tab_joint_text_format (t, 1, r, 2, r, TAB_LEFT, - _("Display Alignment: %s"), - alignment_to_string (var_get_alignment (v))); - r++; + if (flags & DF_ALIGNMENT) + ds_put_format (&s, _("Display Alignment: %s\n"), + alignment_to_string (var_get_alignment (v))); + + if (flags & DF_WIDTH) + ds_put_format (&s, _("Display Width: %d\n"), var_get_display_width (v)); - tab_joint_text_format (t, 1, r, 2, r, TAB_LEFT, - _("Display Width: %d"), - var_get_display_width (v)); - r++; - } - /* Missing values if any. */ if (flags & DF_MISSING_VALUES && var_has_missing_values (v)) { const struct missing_values *mv = var_get_missing_values (v); - char buf[128]; - char *cp; int cnt = 0; int i; - cp = stpcpy (buf, _("Missing Values: ")); + ds_put_cstr (&s, _("Missing Values: ")); if (mv_has_range (mv)) { double x, y; mv_get_range (mv, &x, &y); if (x == LOWEST) - cp += sprintf (cp, "LOWEST THRU %.*g", DBL_DIG + 1, y); + ds_put_format (&s, "LOWEST THRU %.*g", DBL_DIG + 1, y); else if (y == HIGHEST) - cp += sprintf (cp, "%.*g THRU HIGHEST", DBL_DIG + 1, x); + ds_put_format (&s, "%.*g THRU HIGHEST", DBL_DIG + 1, x); else - cp += sprintf (cp, "%.*g THRU %.*g", + ds_put_format (&s, "%.*g THRU %.*g", DBL_DIG + 1, x, DBL_DIG + 1, y); cnt++; @@ -629,70 +632,57 @@ describe_variable (const struct variable *v, struct tab_table *t, int r, { const union value *value = mv_get_value (mv, i); if (cnt++ > 0) - cp += sprintf (cp, "; "); + ds_put_cstr (&s, "; "); if (var_is_numeric (v)) - cp += sprintf (cp, "%.*g", DBL_DIG + 1, value->f); + ds_put_format (&s, "%.*g", DBL_DIG + 1, value->f); else { int width = var_get_width (v); int mv_width = MIN (width, MV_MAX_STRING); - *cp++ = '"'; - memcpy (cp, value_str (value, width), mv_width); - cp += mv_width; - *cp++ = '"'; - *cp = '\0'; + ds_put_byte (&s, '"'); + memcpy (ds_put_uninit (&s, mv_width), + value_str (value, width), mv_width); + ds_put_byte (&s, '"'); } } - - tab_joint_text (t, 1, r, 2, r, TAB_LEFT, buf); - r++; + ds_put_byte (&s, '\n'); } - /* Value labels. */ - if (flags & DF_VALUE_LABELS && var_has_value_labels (v)) - { - const struct val_labs *val_labs = var_get_value_labels (v); - size_t n_labels = val_labs_count (val_labs); - const struct val_lab **labels; - int orig_r = r; - size_t i; - -#if 0 - tab_text (t, 1, r, TAB_LEFT, _("Value")); - tab_text (t, 2, r, TAB_LEFT, _("Label")); - r++; -#endif + ds_chomp_byte (&s, '\n'); - tab_hline (t, TAL_1, 1, 2, r); + table = (ds_is_empty (&s) + ? NULL + : table_from_string (TAB_LEFT, ds_cstr (&s))); + ds_destroy (&s); - labels = val_labs_sorted (val_labs); - for (i = 0; i < n_labels; i++) - { - const struct val_lab *vl = labels[i]; + /* Value labels. */ + if (flags & DF_VALUE_LABELS && var_has_value_labels (v)) + table = table_vpaste (table, table_create_nested (describe_value_labels (v))); - tab_value (t, 1, r, TAB_NONE, &vl->value, v, NULL); - tab_text (t, 2, r, TAB_LEFT, val_lab_get_escaped_label (vl)); - r++; - } - free (labels); + if (flags & (DF_ATTRIBUTES | DF_AT_ATTRIBUTES)) + { + struct attrset *attrs = var_get_attributes (v); - tab_vline (t, TAL_1, 2, orig_r, r - 1); + if (count_attributes (attrs, flags)) + table = table_vpaste ( + table, table_create_nested (describe_attributes (attrs, flags))); } - if (flags & (DF_ATTRIBUTES | DF_AT_ATTRIBUTES) && n_attrs) + if (table == NULL) + table = table_from_string (TAB_LEFT, ""); + + table = table_hpaste (table_from_string (0, var_get_name (v)), + table_stomp (table)); + if (flags & DF_DICT_INDEX) { - tab_joint_text (t, 1, r, 2, r, TAB_LEFT, "Custom attributes:"); - r++; + char s[INT_BUFSIZE_BOUND (size_t)]; - display_attributes (t, var_get_attributes (v), flags, 1, r); - r += n_attrs; + sprintf (s, "%zu", var_get_dict_index (v) + 1); + table = table_hpaste (table, table_from_string (0, s)); } - /* Draw a line below the last row of information on this variable. */ - tab_hline (t, TAL_1, 0, tab_nc (t) - 1, r); - - return r; + return table; } /* Display a list of vectors. If SORTED is nonzero then they are @@ -1103,3 +1093,33 @@ report_encodings (const struct file_handle *h, const struct sfm_reader *r) pool_destroy (pool); } + +static unsigned int +dict_display_mask (const struct dictionary *d) +{ + size_t n_vars = dict_get_var_cnt (d); + unsigned int mask; + size_t i; + + mask = DF_ALL & ~(DF_MEASURE | DF_ROLE | DF_ALIGNMENT | DF_WIDTH); + for (i = 0; i < n_vars; i++) + { + const struct variable *v = dict_get_var (d, i); + enum val_type val = var_get_type (v); + int width = var_get_width (v); + + if (var_get_measure (v) != var_default_measure (val)) + mask |= DF_MEASURE; + + if (var_get_role (v) != ROLE_INPUT) + mask |= DF_ROLE; + + if (var_get_alignment (v) != var_default_alignment (val)) + mask |= DF_ALIGNMENT; + + if (var_get_display_width (v) != var_default_display_width (width)) + mask |= DF_WIDTH; + } + + return mask; +} diff --git a/tests/data/por-file.at b/tests/data/por-file.at index 2020f0a034..a492726ee2 100644 --- a/tests/data/por-file.at +++ b/tests/data/por-file.at @@ -88,32 +88,27 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -O format=csv import.sps], [0], [dnl -Variable,Description,,Position -VAR1,Format: F1.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,1,one, -VAR2,Format: F1.0,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,2,two, -VAR3,Format: F1.0,,3 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,3,three, -VAR4,Format: F1.0,,4 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,4,four, -VAR5,Format: F1.0,,5 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,5,five, +Variable,Description,Position +VAR1,"Format: F1.0 + +Value,Label +1,one",1 +VAR2,"Format: F1.0 + +Value,Label +2,two",2 +VAR3,"Format: F1.0 + +Value,Label +3,three",3 +VAR4,"Format: F1.0 + +Value,Label +4,four",4 +VAR5,"Format: F1.0 + +Value,Label +5,five",5 Table: Data List VAR1,VAR2,VAR3,VAR4,VAR5 diff --git a/tests/data/sys-file-reader.at b/tests/data/sys-file-reader.at index 7291e836e6..e9b262e864 100644 --- a/tests/data/sys-file-reader.at +++ b/tests/data/sys-file-reader.at @@ -130,52 +130,52 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl + AT_CHECK([cat pspp.csv], [0], [dnl File label: PSPP synthetic test file: ôõöø -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Label: Numeric variable 2's label (ùúû),,2 -,Format: F8.0,, -num3,Format: F8.0,,3 -,Missing Values: 1,, -num4,Label: Another numeric variable label,,4 -,Format: F8.0,, -,Missing Values: 1,, -num5,Format: F8.0,,5 -,Missing Values: 1; 2,, -num6,Format: F8.0,,6 -,Missing Values: 1; 2; 3,, -num7,Format: F8.0,,7 -,Missing Values: 1 THRU 3,, -num8,Format: F8.0,,8 -,Missing Values: 1 THRU 3; 5,, -num9,Format: F8.0,,9 -,Missing Values: 1 THRU HIGHEST; -5,, -numàèìñò,Format: F8.0,,10 -,Missing Values: LOWEST THRU 1; 5,, -str1,Format: A4,,11 -str2,Label: String variable 2's label,,12 -,Format: A4,, -str3,Format: A4,,13 -,"Missing Values: ""MISS""",, -str4,Label: Another string variable label,,14 -,Format: A4,, -,"Missing Values: ""OTHR""",, -str5,Format: A4,,15 -,"Missing Values: ""MISS""; ""OTHR""",, -str6,Format: A4,,16 -,"Missing Values: ""MISS""; ""OTHR""; ""MORE""",, -str7,Format: A11,,17 -,"Missing Values: ""first8by""",, -str8,Format: A9,,18 -,"Missing Values: ""abcdefgh""",, -str9,Format: A10,,19 -,"Missing Values: ""abcdefgh""; ""01234567""",, -str10,Format: A11,,20 -,"Missing Values: ""abcdefgh""; ""01234567""; ""0 """,, -str11,Label: 25-byte string,,21 -,Format: A25,, +Variable,Description,Position +num1,Format: F8.0,1 +num2,"Label: Numeric variable 2's label (ùúû) +Format: F8.0",2 +num3,"Format: F8.0 +Missing Values: 1",3 +num4,"Label: Another numeric variable label +Format: F8.0 +Missing Values: 1",4 +num5,"Format: F8.0 +Missing Values: 1; 2",5 +num6,"Format: F8.0 +Missing Values: 1; 2; 3",6 +num7,"Format: F8.0 +Missing Values: 1 THRU 3",7 +num8,"Format: F8.0 +Missing Values: 1 THRU 3; 5",8 +num9,"Format: F8.0 +Missing Values: 1 THRU HIGHEST; -5",9 +numàèìñò,"Format: F8.0 +Missing Values: LOWEST THRU 1; 5",10 +str1,Format: A4,11 +str2,"Label: String variable 2's label +Format: A4",12 +str3,"Format: A4 +Missing Values: ""MISS""",13 +str4,"Label: Another string variable label +Format: A4 +Missing Values: ""OTHR""",14 +str5,"Format: A4 +Missing Values: ""MISS""; ""OTHR""",15 +str6,"Format: A4 +Missing Values: ""MISS""; ""OTHR""; ""MORE""",16 +str7,"Format: A11 +Missing Values: ""first8by""",17 +str8,"Format: A9 +Missing Values: ""abcdefgh""",18 +str9,"Format: A10 +Missing Values: ""abcdefgh""; ""01234567""",19 +str10,"Format: A11 +Missing Values: ""abcdefgh""; ""01234567""; ""0 """,20 +str11,"Label: 25-byte string +Format: A25",21 Table: Data List num1,num2,num3,num4,num5,num6,num7,num8,num9,numàèìñò,str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11 @@ -222,11 +222,11 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Label: Numeric variable 2's label,,2 -,Format: F8.0,, + AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,Position +num1,Format: F8.0,1 +num2,"Label: Numeric variable 2's label +Format: F8.0",2 Table: Data List num1,num2 @@ -276,11 +276,11 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Label: Numeric variable 2's label,,2 -,Format: F8.0,, + AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,Position +num1,Format: F8.0,1 +num2,"Label: Numeric variable 2's label +Format: F8.0",2 Table: Data List num1,num2 @@ -409,61 +409,95 @@ GET FILE='sys-file.sav'. DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -,1,один (in Russian), -num2,Format: F8.0,,2 -,1,one, -,2,two, -num3,Format: F8.0,,3 -,3,three, -,4,four, -num4,Format: F8.0,,4 -,5,five, -,7,seven, -,8,eight, -,9,nine, -num5,Format: F8.0,,5 -,6,six, -,7,seven, -,8,eight, -,10,ten, -str1,Format: A1,,6 -,a,value label for `a', -str2,Format: A2,,7 -,bc,value label for `bc', -,de,value label for `de', -str3,Format: A3,,8 -,fgh,value label for `fgh', -,ijk,value label for `ijk', -str4,Format: A4,,9 -,BCDE,value label for `BCDE', -,lmno,value label for `lmno', -,tuvw,value label for `tuvw', -,xyzA,value label for `xyzA', -str5,Format: A4,,10 -,FGHI,value label for `FGHI', -,pqrs,value label for `pqrs', -,tuvw,value label for `tuvw', -,xyzA,value label for `xyzA', -str6,Format: A6,,11 -,JKLMNO,value label for `JKLMNO', -str7,Format: A7,,12 -,JKLMNOP,value label for `JKLMNOP', -str8,Format: A8,,13 -,JKLMNOPQ,value label for `JKLMNOPQ', -str9ж,Format: A9,,14 -,RSTUVWXYZ,value label for `RSTUVWXYZ', -str12,Format: A12,,15 -,0123456789ab,value label for `0123456789ab', -,cdefghijklmn,value label for `cdefghijklmn', -str16,Format: A16,,16 -,EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST', -,UVWXYZ0123456789,value label for `UVWXYZ0123456789' with Cyrillic letters: `фхц', -,opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD', -str17,Format: A17,,17 -,abcdefghijklmnopq,value label for `abcdefghijklmnopq', + AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,Position +num1,"Format: F8.0 + +Value,Label +1,один (in Russian)",1 +num2,"Format: F8.0 + +Value,Label +1,one +2,two",2 +num3,"Format: F8.0 + +Value,Label +3,three +4,four",3 +num4,"Format: F8.0 + +Value,Label +5,five +7,seven +8,eight +9,nine",4 +num5,"Format: F8.0 + +Value,Label +6,six +7,seven +8,eight +10,ten",5 +str1,"Format: A1 + +Value,Label +a,value label for `a'",6 +str2,"Format: A2 + +Value,Label +bc,value label for `bc' +de,value label for `de'",7 +str3,"Format: A3 + +Value,Label +fgh,value label for `fgh' +ijk,value label for `ijk'",8 +str4,"Format: A4 + +Value,Label +BCDE,value label for `BCDE' +lmno,value label for `lmno' +tuvw,value label for `tuvw' +xyzA,value label for `xyzA'",9 +str5,"Format: A4 + +Value,Label +FGHI,value label for `FGHI' +pqrs,value label for `pqrs' +tuvw,value label for `tuvw' +xyzA,value label for `xyzA'",10 +str6,"Format: A6 + +Value,Label +JKLMNO,value label for `JKLMNO'",11 +str7,"Format: A7 + +Value,Label +JKLMNOP,value label for `JKLMNOP'",12 +str8,"Format: A8 + +Value,Label +JKLMNOPQ,value label for `JKLMNOPQ'",13 +str9ж,"Format: A9 + +Value,Label +RSTUVWXYZ,value label for `RSTUVWXYZ'",14 +str12,"Format: A12 + +Value,Label +0123456789ab,value label for `0123456789ab' +cdefghijklmn,value label for `cdefghijklmn'",15 +str16,"Format: A16 + +Value,Label +EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST' +UVWXYZ0123456789,value label for `UVWXYZ0123456789' with Cyrillic letters: `фхц' +opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD'",16 +str17,"Format: A17 + +Value,Label +abcdefghijklmnopq,value label for `abcdefghijklmnopq'",17 ]) done AT_CLEANUP @@ -763,55 +797,43 @@ DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -a,Format: F8.0,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -b,Format: F8.0,,2 -,Measure: Ordinal,, -,Display Alignment: Left,, -,Display Width: 8,, -c,Format: F8.0,,3 -,Measure: Scale,, -,Display Alignment: Left,, -,Display Width: 8,, -d,Format: F8.0,,4 -,Measure: Nominal,, -,Display Alignment: Right,, -,Display Width: 8,, -h,Format: A3,,5 -,Measure: Ordinal,, -,Display Alignment: Right,, -,Display Width: 3,, -i,Format: A3,,6 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 3,, -j,Format: A3,,7 -,Measure: Nominal,, -,Display Alignment: Center,, -,Display Width: 3,, -k,Format: A3,,8 -,Measure: Ordinal,, -,Display Alignment: Center,, -,Display Width: 3,, -l,Format: A9,,9 -,Measure: Scale,, -,Display Alignment: Center,, -,Display Width: 9,, -m,Format: A10,,10 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 10,, -n,Format: A17,,11 -,Measure: Nominal,, -,Display Alignment: Right,, -,Display Width: 17,, -o,Format: A25,,12 -,Measure: Nominal,, -,Display Alignment: Center,, -,Display Width: 25,, +Variable,Description,Position +a,"Format: F8.0 +Measure: Nominal +Display Alignment: Left",1 +b,"Format: F8.0 +Measure: Ordinal +Display Alignment: Left",2 +c,"Format: F8.0 +Measure: Scale +Display Alignment: Left",3 +d,"Format: F8.0 +Measure: Nominal +Display Alignment: Right",4 +h,"Format: A3 +Measure: Ordinal +Display Alignment: Right",5 +i,"Format: A3 +Measure: Scale +Display Alignment: Right",6 +j,"Format: A3 +Measure: Nominal +Display Alignment: Center",7 +k,"Format: A3 +Measure: Ordinal +Display Alignment: Center",8 +l,"Format: A9 +Measure: Scale +Display Alignment: Center",9 +m,"Format: A10 +Measure: Nominal +Display Alignment: Left",10 +n,"Format: A17 +Measure: Nominal +Display Alignment: Right",11 +o,"Format: A25 +Measure: Nominal +Display Alignment: Center",12 ]) done AT_CLEANUP @@ -881,55 +903,55 @@ DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -a,Format: F8.0,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 1,, -b,Format: F8.0,,2 -,Measure: Ordinal,, -,Display Alignment: Left,, -,Display Width: 2,, -c,Format: F8.0,,3 -,Measure: Scale,, -,Display Alignment: Left,, -,Display Width: 3,, -d,Format: F8.0,,4 -,Measure: Nominal,, -,Display Alignment: Right,, -,Display Width: 4,, -h,Format: A3,,5 -,Measure: Ordinal,, -,Display Alignment: Right,, -,Display Width: 5,, -i,Format: A3,,6 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 6,, -j,Format: A3,,7 -,Measure: Nominal,, -,Display Alignment: Center,, -,Display Width: 7,, -k,Format: A3,,8 -,Measure: Ordinal,, -,Display Alignment: Center,, -,Display Width: 8,, -l,Format: A9,,9 -,Measure: Scale,, -,Display Alignment: Center,, -,Display Width: 9,, -m,Format: A10,,10 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 10,, -n,Format: A17,,11 -,Measure: Nominal,, -,Display Alignment: Right,, -,Display Width: 11,, -o,Format: A25,,12 -,Measure: Nominal,, -,Display Alignment: Center,, -,Display Width: 12,, +Variable,Description,Position +a,"Format: F8.0 +Measure: Nominal +Display Alignment: Left +Display Width: 1",1 +b,"Format: F8.0 +Measure: Ordinal +Display Alignment: Left +Display Width: 2",2 +c,"Format: F8.0 +Measure: Scale +Display Alignment: Left +Display Width: 3",3 +d,"Format: F8.0 +Measure: Nominal +Display Alignment: Right +Display Width: 4",4 +h,"Format: A3 +Measure: Ordinal +Display Alignment: Right +Display Width: 5",5 +i,"Format: A3 +Measure: Scale +Display Alignment: Right +Display Width: 6",6 +j,"Format: A3 +Measure: Nominal +Display Alignment: Center +Display Width: 7",7 +k,"Format: A3 +Measure: Ordinal +Display Alignment: Center +Display Width: 8",8 +l,"Format: A9 +Measure: Scale +Display Alignment: Center +Display Width: 9",9 +m,"Format: A10 +Measure: Nominal +Display Alignment: Left +Display Width: 10",10 +n,"Format: A17 +Measure: Nominal +Display Alignment: Right +Display Width: 11",11 +o,"Format: A25 +Measure: Nominal +Display Alignment: Center +Display Width: 12",12 ]) done AT_CLEANUP @@ -987,15 +1009,15 @@ GET FILE='sys-file.sav'. DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -LongVariableName1,Format: F8.0,,1 -LongVariableName2,Format: F8.0,,2 -LongVariableName3,Format: F8.0,,3 -LongVariableName4,Format: F8.0,,4 -Coördinate_X,Format: F8.0,,5 -Coördinate_Y,Format: F8.0,,6 -Coördinate_Z,Format: F8.0,,7 + AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,Position +LongVariableName1,Format: F8.0,1 +LongVariableName2,Format: F8.0,2 +LongVariableName3,Format: F8.0,3 +LongVariableName4,Format: F8.0,4 +Coördinate_X,Format: F8.0,5 +Coördinate_Y,Format: F8.0,6 +Coördinate_Z,Format: F8.0,7 ]) done AT_CLEANUP @@ -1056,10 +1078,10 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -séq256,Format: A256,,1 -str600,Format: A600,,2 + AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,Position +séq256,Format: A256,1 +str600,Format: A600,2 Table: Data List séq256,str600 @@ -1126,14 +1148,14 @@ DISPLAY @ATTRIBUTES. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], -[[Variable,Description, -FirstVariable,Custom attributes:, -,$@Role,1 -,adèle[1],23 -,adèle[2],34 -,bert,123 -SécondVariable,Custom attributes:, -,xyzzy,quux +[[Variable,Description +FirstVariable,"Attribute,Value +$@Role,1 +adèle[1],23 +adèle[2],34 +bert,123" +SécondVariable,"Attribute,Value +xyzzy,quux" Table: Custom data file attributes. Attribute,Value @@ -1147,17 +1169,20 @@ GET FILE='sys-file.sav'. DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], -[[Variable,Description,,Position -FirstVariable,Format: F8.0,,1 -,Role: Output,, -,Custom attributes:,, -,adèle[1],23, -,adèle[2],34, -,bert,123, -SécondVariable,Format: F8.0,,2 -,Custom attributes:,, -,xyzzy,quux, + AT_CHECK([cat pspp.csv], [0], +[[Variable,Description,Position +FirstVariable,"Format: F8.0 +Role: Output + +Attribute,Value +adèle[1],23 +adèle[2],34 +bert,123",1 +SécondVariable,"Format: F8.0 +Role: Input + +Attribute,Value +xyzzy,quux",2 Table: Custom data file attributes. Attribute,Value @@ -1221,22 +1246,24 @@ DISPLAY DICTIONARY. AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [dnl warning: `sys-file.sav': Invalid role for variable x. ]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl + AT_CHECK([cat pspp.csv], [0], [dnl warning: `sys-file.sav': Invalid role for variable x. -Variable,Description,,Position -i,Format: F8.0,,1 -o,Format: F8.0,,2 -,Role: Output,, -b,Format: F8.0,,3 -,Role: Both,, -n,Format: F8.0,,4 -,Role: None,, -p,Format: F8.0,,5 -,Role: Partition,, -s,Format: F8.0,,6 -,Role: Split,, -x,Format: F8.0,,7 +Variable,Description,Position +i,"Format: F8.0 +Role: Input",1 +o,"Format: F8.0 +Role: Output",2 +b,"Format: F8.0 +Role: Both",3 +n,"Format: F8.0 +Role: None",4 +p,"Format: F8.0 +Role: Partition",5 +s,"Format: F8.0 +Role: Split",6 +x,"Format: F8.0 +Role: Input",7 ]) done AT_CLEANUP @@ -1286,13 +1313,13 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Format: F8.0,,2 -str4,Format: A4,,3 -str8,Format: A8,,4 -str15,Format: A15,,5 + AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,Position +num1,Format: F8.0,1 +num2,Format: F8.0,2 +str4,Format: A4,3 +str8,Format: A8,4 +str15,Format: A15,5 Table: Data List num1,num2,str4,str8,str15 @@ -1348,13 +1375,13 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps], [0]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Format: F8.0,,2 -str4,Format: A4,,3 -str8,Format: A8,,4 -str15,Format: A15,,5 + AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,Position +num1,Format: F8.0,1 +num2,Format: F8.0,2 +str4,Format: A4,3 +str8,Format: A8,4 +str15,Format: A15,5 Table: Data List num1,num2,str4,str8,str15 @@ -1412,15 +1439,15 @@ LIST. AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format. ]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl + AT_CHECK([cat pspp.csv], [0], [dnl "warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format." -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Format: F8.0,,2 -str4,Format: A4,,3 -str8,Format: A8,,4 -str15,Format: A15,,5 +Variable,Description,Position +num1,Format: F8.0,1 +num2,Format: F8.0,2 +str4,Format: A4,3 +str8,Format: A8,4 +str15,Format: A15,5 Table: Data List num1,num2,str4,str8,str15 @@ -1511,13 +1538,13 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Format: F8.0,,2 -str4,Format: A4,,3 -str8,Format: A8,,4 -str15,Format: A15,,5 + AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,Position +num1,Format: F8.0,1 +num2,Format: F8.0,2 +str4,Format: A4,3 +str8,Format: A8,4 +str15,Format: A15,5 Table: Data List num1,num2,str4,str8,str15 @@ -1743,15 +1770,9 @@ DISPLAY DICTIONARY. AT_CHECK([pspp -O format=csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0xd4: Renaming variable with duplicate name `VAR1' to `VAR001'. -Variable,Description,,Position -var1,Format: F8.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -var001,Format: F8.0,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +var1,Format: F8.0,1 +var001,Format: F8.0,2 ]) done AT_CLEANUP @@ -1989,24 +2010,12 @@ warning: `sys-file.sav' near offset 0x257: Ignoring long string missing value re "warning: `sys-file.sav' near offset 0x270: Ignoring long string missing value 0 for variable str3, with width 11, that has bad value width 12." -Variable,Description,,Position -num1,Format: F8.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -str1,Format: A9,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 9,, -str2,Format: A10,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 10,, -,"Missing Values: ""abcdefgh""; ""ijklmnop""; ""qrstuvwx""",, -str3,Format: A11,,4 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 11,, +Variable,Description,Position +num1,Format: F8.0,1 +str1,Format: A9,2 +str2,"Format: A10 +Missing Values: ""abcdefgh""; ""ijklmnop""; ""qrstuvwx""",3 +str3,Format: A11,4 ]) done AT_CLEANUP @@ -2038,15 +2047,9 @@ DISPLAY DICTIONARY. AT_CHECK([pspp -O format=csv sys-file.sps], [0], [warning: `sys-file.sav': Ignoring string variable `STR1' set as weighting variable. -Variable,Description,,Position -num1,Format: F8.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -str1,Format: A4,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 4,, +Variable,Description,Position +num1,Format: F8.0,1 +str1,Format: A4,2 ]) done AT_CLEANUP @@ -2317,11 +2320,8 @@ DISPLAY DICTIONARY. AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl warning: \`sys-file.sav' near offset 0xd8: Integer format indicated by system file (3) differs from expected ($[2]). -Variable,Description,,Position -num1,Format: F8.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +num1,Format: F8.0,1 ]) done AT_CLEANUP diff --git a/tests/data/sys-file.at b/tests/data/sys-file.at index bd5671cb01..3e1fbb1fac 100644 --- a/tests/data/sys-file.at +++ b/tests/data/sys-file.at @@ -73,28 +73,23 @@ DISPLAY DICTIONARY. EOF AT_CHECK([pspp -o pspp.csv sysfile.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -s1,Format: A9,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 9,, -,"Missing Values: ""0 """,, -,abc ,First value label, -,abcdefgh ,Second value label, -,abcdefghi,Third value label, -s2,Format: A9,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 9,, -,"Missing Values: ""12 ""; ""123 """,, -,0 ,Fourth value label, -,01234567 ,Fifth value label, -,012345678,Sixth value label, -s3,Format: A9,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 9,, -,"Missing Values: ""1234 ""; ""12345 ""; ""12345678""",, +Variable,Description,Position +s1,"Format: A9 +Missing Values: ""0 "" + +Value,Label +abc ,First value label +abcdefgh ,Second value label +abcdefghi,Third value label",1 +s2,"Format: A9 +Missing Values: ""12 ""; ""123 "" + +Value,Label +0 ,Fourth value label +01234567 ,Fifth value label +012345678,Sixth value label",2 +s3,"Format: A9 +Missing Values: ""1234 ""; ""12345 ""; ""12345678""",3 ]) AT_CHECK_UNQUOTED([dd if=foo.sav bs=1 count=4; echo], [0], [$magic ], [ignore]) @@ -259,11 +254,11 @@ LIST. ]) AT_CHECK([pspp -o pspp.csv get.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Label,,Position -cont,continents of the world,,1 -size,sq km,,2 -pop,population,,3 -count,number of countries,,4 +Variable,Label,Position +cont,continents of the world,1 +size,sq km,2 +pop,population,3 +count,number of countries,4 Table: Data List cont,size,pop,count @@ -327,23 +322,15 @@ LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -N,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 10,, -A255,Format: A255,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, -A258,Format: A258,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, -A2000,Format: A2000,,4 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, +Variable,Description,Position +N,"Format: F8.2 +Display Width: 10",1 +A255,"Format: A255 +Display Width: 32",2 +A258,"Format: A258 +Display Width: 32",3 +A2000,"Format: A2000 +Display Width: 32",4 Table: Data List N,A255,A258,A2000 @@ -361,23 +348,15 @@ LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -vl255,Format: A255,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 26,, -vl256,Format: A256,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 26,, -vl1335,Format: A1335,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 26,, -vl2000,Format: A2000,,4 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 26,, +Variable,Description,Position +vl255,"Format: A255 +Display Width: 26",1 +vl256,"Format: A256 +Display Width: 26",2 +vl1335,"Format: A1335 +Display Width: 26",3 +vl2000,"Format: A2000 +Display Width: 26",4 Table: Data List vl255,vl256,vl1335,vl2000 @@ -421,23 +400,11 @@ EXECUTE. ]) AT_CHECK([pspp -o pspp.csv get.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -a,Format: A10,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 10,, -b,Format: A256,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, -c,Format: A200,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, -d,Format: A32767,,4 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, +Variable,Description,Position +a,Format: A10,1 +b,Format: A256,2 +c,Format: A200,3 +d,Format: A32767,4 ]) AT_CLEANUP]) @@ -494,24 +461,20 @@ jalapeño vicuña. (Entered ) -Variable,Description,,Position -àéîöçxyzabc,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,1.00,éclair élan, -,Custom attributes:,, -,Atatürk,Düsseldorf Gewürztraminer, -roué,Label: Provençal soupçon,,2 -,Format: A9,, -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 9,, -,abcdefghi,sauté précis, -croûton,Format: A1000,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, +Variable,Description,Position +àéîöçxyzabc,"Format: F8.2 + +Value,Label +1.00,éclair élan + +Attribute,Value +Atatürk,Düsseldorf Gewürztraminer",1 +roué,"Label: Provençal soupçon +Format: A9 + +Value,Label +abcdefghi,sauté précis",2 +croûton,Format: A1000,3 Table: Custom data file attributes. Attribute,Value diff --git a/tests/language/data-io/get-data-psql.at b/tests/language/data-io/get-data-psql.at index 163b7e36d6..692de0957b 100644 --- a/tests/language/data-io/get-data-psql.at +++ b/tests/language/data-io/get-data-psql.at @@ -138,95 +138,29 @@ EOF ]) AT_CHECK([pspp -o pspp.csv ordinary-query.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -bool,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -bytea,Format: AHEX2,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 1,, -char,Format: A8,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -int8,Format: F8.2,,4 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -int2,Format: F8.2,,5 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -int4,Format: F8.2,,6 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -numeric,Format: E40.6,,7 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -text,Format: A16,,8 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 16,, -oid,Format: F8.2,,9 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -float4,Format: F8.2,,10 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -float8,Format: F8.2,,11 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -money,Format: DOLLAR8.2,,12 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -pbchar,Format: A8,,13 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -varchar,Format: A8,,14 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -date,Format: DATE11,,15 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -time,Format: TIME11.0,,16 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -timestamp,Format: DATETIME22.0,,17 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -timestamptz,Format: DATETIME22.0,,18 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -interval,Format: DTIME13.0,,19 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -interval_months,Format: F3.0,,20 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -timetz,Format: TIME11.0,,21 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -timetz_zone,Format: F8.2,,22 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +bool,Format: F8.2,1 +bytea,Format: AHEX2,2 +char,Format: A8,3 +int8,Format: F8.2,4 +int2,Format: F8.2,5 +int4,Format: F8.2,6 +numeric,Format: E40.6,7 +text,Format: A16,8 +oid,Format: F8.2,9 +float4,Format: F8.2,10 +float8,Format: F8.2,11 +money,Format: DOLLAR8.2,12 +pbchar,Format: A8,13 +varchar,Format: A8,14 +date,Format: DATE11,15 +time,Format: TIME11.0,16 +timestamp,Format: DATETIME22.0,17 +timestamptz,Format: DATETIME22.0,18 +interval,Format: DTIME13.0,19 +interval_months,Format: F3.0,20 +timetz,Format: TIME11.0,21 +timetz_zone,Format: F8.2,22 Table: Data List bool,bytea,char,int8,int2,int4,numeric,text,oid,float4,float8,money,pbchar,varchar,date,time,timestamp,timestamptz,interval,interval_months,timetz,timetz_zone @@ -249,19 +183,10 @@ EOF ]) AT_CHECK([pspp -o pspp.csv empty-result.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -a,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -b,Format: DATE11,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -c,Format: E40.2,,3 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +a,Format: F8.2,1 +b,Format: DATE11,2 +c,Format: E40.2,3 ]) dnl Test query with large result set. diff --git a/tests/language/data-io/get-data-spreadsheet.at b/tests/language/data-io/get-data-spreadsheet.at index 78ae754c8c..b6a18ddf2c 100644 --- a/tests/language/data-io/get-data-spreadsheet.at +++ b/tests/language/data-io/get-data-spreadsheet.at @@ -23,19 +23,10 @@ LIST. ]) AT_CHECK([pspp -o pspp.csv get-data.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -VAR001,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -VAR002,Format: A8,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -VAR003,Format: F8.2,,3 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +VAR001,Format: F8.2,1 +VAR002,Format: A8,2 +VAR003,Format: F8.2,3 Table: Data List VAR001,VAR002,VAR003 @@ -56,19 +47,10 @@ LIST. ]) AT_CHECK([pspp -o pspp.csv get-data.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -V1,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -V2,Format: A8,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -VAR001,Format: F8.2,,3 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +V1,Format: F8.2,1 +V2,Format: A8,2 +VAR001,Format: F8.2,3 Table: Data List V1,V2,VAR001 @@ -88,19 +70,10 @@ DISPLAY VARIABLES. LIST. ]) AT_CHECK([pspp -O format=csv get-data.sps], [0], [dnl -Variable,Description,,Position -name,Format: A8,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -id,Format: F8.2,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -height,Format: F8.2,,3 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +name,Format: A8,1 +id,Format: F8.2,2 +height,Format: F8.2,3 warning: Cannot convert the value in the spreadsheet cell C4 to format (F8.2): Field contents are not numeric. @@ -123,23 +96,11 @@ LIST. ]) AT_CHECK([pspp -o pspp.csv get-data.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -vone,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -vtwo,Format: F8.2,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -vthree,Format: A8,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -v4,Format: F8.2,,4 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +vone,Format: F8.2,1 +vtwo,Format: F8.2,2 +vthree,Format: A8,3 +v4,Format: F8.2,4 Table: Data List vone,vtwo,vthree,v4 diff --git a/tests/language/data-io/list.at b/tests/language/data-io/list.at index c3a9dbe7bd..6716354ccf 100644 --- a/tests/language/data-io/list.at +++ b/tests/language/data-io/list.at @@ -215,11 +215,8 @@ LIST. ]) AT_CHECK([pspp -o pspp.csv list.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -foo,Format: A2000,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, +Variable,Description,Position +foo,Format: A2000,1 Table: Data List foo diff --git a/tests/language/dictionary/attributes.at b/tests/language/dictionary/attributes.at index be75e8c03d..492709a875 100644 --- a/tests/language/dictionary/attributes.at +++ b/tests/language/dictionary/attributes.at @@ -35,15 +35,15 @@ VARIABLE ATTRIBUTE DISPLAY ATTRIBUTES. ]]) AT_CHECK([pspp -O format=csv save-attrs.pspp], [0], - [[Variable,Description, -a,Custom attributes:, -,ValidationRule[1],a * b > 3 -,ValidationRule[2],a + b > 2 -b,Custom attributes:, -,ValidationRule[1],a * b > 3 -,ValidationRule[2],a + b > 2 -c,Custom attributes:, -,QuestionWording,X or Y? + [[Variable,Description +a,"Attribute,Value +ValidationRule[1],a * b > 3 +ValidationRule[2],a + b > 2" +b,"Attribute,Value +ValidationRule[1],a * b > 3 +ValidationRule[2],a + b > 2" +c,"Attribute,Value +QuestionWording,X or Y?" Table: Custom data file attributes. Attribute,Value @@ -52,11 +52,12 @@ array[2],array element 2 key,value ]]) AT_CHECK([pspp -O format=csv get-attrs.pspp], [0], [dnl -Variable,Description, -b,Custom attributes:, -,ValidationRule,a * b > 3 -c,Custom attributes:, -,QuestionWording,X or Y? +Variable,Description +a, +b,"Attribute,Value +ValidationRule,a * b > 3" +c,"Attribute,Value +QuestionWording,X or Y?" Table: Custom data file attributes. Attribute,Value diff --git a/tests/language/dictionary/formats.at b/tests/language/dictionary/formats.at index d3c2e65e20..b1364f76f5 100644 --- a/tests/language/dictionary/formats.at +++ b/tests/language/dictionary/formats.at @@ -20,29 +20,29 @@ x,A1 y,A2 z,A3 -Variable,Description,,Position -a,Format: F8.2,,1 -b,Format: F8.2,,2 -c,Format: F8.2,,3 -x,Format: A1,,4 -y,Format: A2,,5 -z,Format: A3,,6 +Variable,Description,Position +a,Format: F8.2,1 +b,Format: F8.2,2 +c,Format: F8.2,3 +x,Format: A1,4 +y,Format: A2,5 +z,Format: A3,6 -Variable,Description,,Position -a,Format: COMMA10.0,,1 -b,Format: N4.0,,2 -c,Format: F8.2,,3 -x,Format: A1,,4 -y,Format: A2,,5 -z,Format: A3,,6 +Variable,Description,Position +a,Format: COMMA10.0,1 +b,Format: N4.0,2 +c,Format: F8.2,3 +x,Format: A1,4 +y,Format: A2,5 +z,Format: A3,6 -Variable,Description,,Position -a,Format: COMMA10.0,,1 -b,Format: N4.0,,2 -c,Format: E8.1,,3 -x,Format: A1,,4 -y,Format: AHEX4,,5 -z,Format: A3,,6 +Variable,Description,Position +a,Format: COMMA10.0,1 +b,Format: N4.0,2 +c,Format: E8.1,3 +x,Format: A1,4 +y,Format: AHEX4,5 +z,Format: A3,6 ]) AT_CLEANUP diff --git a/tests/language/dictionary/missing-values.at b/tests/language/dictionary/missing-values.at index 84ee172529..214fc3f0fa 100644 --- a/tests/language/dictionary/missing-values.at +++ b/tests/language/dictionary/missing-values.at @@ -62,103 +62,67 @@ MISSING VALUES ALL (). DISPLAY DICTIONARY ]) AT_CHECK([pspp -o pspp.csv missing-values.sps]) -AT_CHECK([sed -n '/Format/s/,.*/:/p -s/"//g -s/^,Missing Values: \([[^,]]*\),.*/\1/p -/^$/p' pspp.csv +AT_CHECK([sed -n '/^$/p; /^@<:@^"@:>@*"@<:@^"@:>@*$/N; s/^\(@<:@a-z0-9@:>@*\),".*Missing Values: \(.*\)",@<:@0-9@:>@*$/\1: \2/p; s/^\(@<:@a-z0-9@:>@*\),Format: @<:@A-Z0-9.@:>@*,@<:@0-9@:>@*$/\1: none/p' pspp.csv ], [0], [dnl -date1: -1 -num1: -1 - -date1: -1; 2 -num1: -1; 2 - -date1: -1; 2; 3 -num1: -1; 2; 3 - -date1: -9999998; 9999984; 3 -num1: -9999998; 9999984; 3 - -date1: -1 -num1: -1 - -date1: -1; 2 -num1: -1; 2 - -date1: -1; 2; 3 -num1: -1; 2; 3 - -date1: -13342665600 -num1: -13342665600 - -date1: -13342665600; 12495427200 -num1: -13342665600; 12495427200 - -date1: -13342665600; 12495427200; 12570336000 -num1: -13342665600; 12495427200; 12570336000 - -num1: -1 THRU 2 - -num1: -LOWEST THRU 2 - -num1: -LOWEST THRU 2 - -num1: -1 THRU HIGHEST - -num1: -1 THRU HIGHEST - -num1: -1 THRU 2; 3 - -num1: -LOWEST THRU 2; 3 - -num1: -LOWEST THRU 2; 3 - -num1: -1 THRU HIGHEST; -1 - -num1: -1 THRU HIGHEST; -1 - -str1: -abc ; def @&t@ -str2: -abc; def -longstr: -abc ; def @&t@ - -str1: -str2: -date1: -num1: -longstr: +date1: 1 +num1: 1 + +date1: 1; 2 +num1: 1; 2 + +date1: 1; 2; 3 +num1: 1; 2; 3 + +date1: 9999998; 9999984; 3 +num1: 9999998; 9999984; 3 + +date1: 1 +num1: 1 + +date1: 1; 2 +num1: 1; 2 + +date1: 1; 2; 3 +num1: 1; 2; 3 + +date1: 13342665600 +num1: 13342665600 + +date1: 13342665600; 12495427200 +num1: 13342665600; 12495427200 + +date1: 13342665600; 12495427200; 12570336000 +num1: 13342665600; 12495427200; 12570336000 + +num1: 1 THRU 2 + +num1: LOWEST THRU 2 + +num1: LOWEST THRU 2 + +num1: 1 THRU HIGHEST + +num1: 1 THRU HIGHEST + +num1: 1 THRU 2; 3 + +num1: LOWEST THRU 2; 3 + +num1: LOWEST THRU 2; 3 + +num1: 1 THRU HIGHEST; -1 + +num1: 1 THRU HIGHEST; -1 + +str1: ""abc ""; ""def "" +str2: ""abc""; ""def"" +longstr: ""abc ""; ""def "" + +str1: none +str2: none +date1: none +num1: none +longstr: none ]) AT_CLEANUP diff --git a/tests/language/dictionary/sys-file-info.at b/tests/language/dictionary/sys-file-info.at index 45eb3afbdf..d7f4c3fa57 100644 --- a/tests/language/dictionary/sys-file-info.at +++ b/tests/language/dictionary/sys-file-info.at @@ -33,14 +33,16 @@ Type:,System File Weight:,Not weighted. Compression:,SAV -Variable,Description,,Position -x,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -name,Format: A10,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 10,, +Variable,Description,Position +x,"Format: F8.2 +Measure: Scale +Role: Input +Display Alignment: Right +Display Width: 8",1 +name,"Format: A10 +Measure: Nominal +Role: Input +Display Alignment: Left +Display Width: 10",2 ]) AT_CLEANUP diff --git a/tests/language/dictionary/value-labels.at b/tests/language/dictionary/value-labels.at index 4c9f43976d..b3a2f8f859 100644 --- a/tests/language/dictionary/value-labels.at +++ b/tests/language/dictionary/value-labels.at @@ -10,19 +10,17 @@ VALUE LABELS ad 'july 10, 1982' 'label 1' DISPLAY DICTIONARY. ]) AT_CHECK([pspp -O format=csv value-labels.sps], [0], [dnl -Variable,Description,,Position -ad,Format: ADATE10,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,07/10/1982,label 1, -,01/02/1993,label 2, -,05/04/2003,label 3, -dt,Format: DATETIME20.0,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,12-APR-2011 06:09:56,label 4, +Variable,Description,Position +ad,"Format: ADATE10 + +Value,Label +07/10/1982,label 1 +01/02/1993,label 2 +05/04/2003,label 3",1 +dt,"Format: DATETIME20.0 + +Value,Label +12-APR-2011 06:09:56,label 4",2 ]) AT_CLEANUP @@ -39,14 +37,13 @@ DISPLAY DICTIONARY. FREQUENCIES x/STAT=NONE. ]) AT_CHECK([pspp -O format=csv value-labels.sps], [0], [dnl -Variable,Description,,Position -x,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,1.00,one, -,2.00,first line\nsecond line, -,3.00,three, +Variable,Description,Position +x,"Format: F8.2 + +Value,Label +1.00,one +2.00,first line\nsecond line +3.00,three",1 Table: x Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent @@ -76,14 +73,13 @@ DISPLAY DICTIONARY. FREQUENCIES x/STAT=NONE. ]) AT_CHECK([pspp -O format=csv get.sps], [0], [dnl -Variable,Description,,Position -x,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,1.00,one, -,2.00,first line\nsecond line, -,3.00,three, +Variable,Description,Position +x,"Format: F8.2 + +Value,Label +1.00,one +2.00,first line\nsecond line +3.00,three",1 Table: x Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent diff --git a/tests/language/dictionary/variable-display.at b/tests/language/dictionary/variable-display.at index c42fc629e2..3bcbd8fc78 100644 --- a/tests/language/dictionary/variable-display.at +++ b/tests/language/dictionary/variable-display.at @@ -11,22 +11,22 @@ DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv var-display.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -x,Format: F8.2,,1 -,Measure: Scale,, -,Role: Output,, -,Display Alignment: Left,, -,Display Width: 10,, -y,Format: F8.2,,2 -,Measure: Ordinal,, -,Role: Both,, -,Display Alignment: Right,, -,Display Width: 12,, -z,Format: F8.2,,3 -,Measure: Nominal,, -,Role: None,, -,Display Alignment: Center,, -,Display Width: 14,, +Variable,Description,Position +x,"Format: F8.2 +Measure: Scale +Role: Output +Display Alignment: Left +Display Width: 10",1 +y,"Format: F8.2 +Measure: Ordinal +Role: Both +Display Alignment: Right +Display Width: 12",2 +z,"Format: F8.2 +Measure: Nominal +Role: None +Display Alignment: Center +Display Width: 14",3 ]) AT_CLEANUP diff --git a/tests/language/stats/autorecode.at b/tests/language/stats/autorecode.at index 19dc0fcb73..6a8ff8e731 100644 --- a/tests/language/stats/autorecode.at +++ b/tests/language/stats/autorecode.at @@ -87,23 +87,16 @@ oojars ,5.00,1.00 thingummies ,6.00,3.00 oojimiflips ,7.00,2.00 -Variable,Description,,Position -s,Format: A16,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 16,, -x,Format: F8.2,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -new,Format: F8.2,,3 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,1.00,oojars, -,2.00,oojimiflips, -,3.00,thingummies, -,4.00,widgets, +Variable,Description,Position +s,Format: A16,1 +x,Format: F8.2,2 +new,"Format: F8.2 + +Value,Label +1.00,oojars +2.00,oojimiflips +3.00,thingummies +4.00,widgets",3 ]) AT_CLEANUP diff --git a/tests/language/stats/rank.at b/tests/language/stats/rank.at index d29e2e8df6..2b909b9e54 100644 --- a/tests/language/stats/rank.at +++ b/tests/language/stats/rank.at @@ -117,45 +117,21 @@ a into count(N of a) b into Nb(N of b) -Variable,Description,,Position -a,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -b,Format: F8.2,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -Ra,Label: RANK of a,,3 -,Format: F9.3,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -RFR001,Label: RFRACTION of a,,4 -,Format: F6.4,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -count,Label: N of a,,5 -,Format: F6.0,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -Rb,Label: RANK of b,,6 -,Format: F9.3,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -RFR002,Label: RFRACTION of b,,7 -,Format: F6.4,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -Nb,Label: N of b,,8 -,Format: F6.0,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +a,Format: F8.2,1 +b,Format: F8.2,2 +Ra,"Label: RANK of a +Format: F9.3",3 +RFR001,"Label: RFRACTION of a +Format: F6.4",4 +count,"Label: N of a +Format: F6.0",5 +Rb,"Label: RANK of b +Format: F9.3",6 +RFR002,"Label: RFRACTION of b +Format: F6.4",7 +Nb,"Label: N of b +Format: F6.0",8 Table: Data List a,b,Ra,RFR001,count,Rb,RFR002,Nb @@ -530,24 +506,12 @@ Variables Created By RANK foo into RAN001(RANK of foo) -Variable,Description,,Position -foo,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -rfoo,Format: F8.2,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -ran003,Format: F8.2,,3 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -RAN001,Label: RANK of foo,,4 -,Format: F9.3,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +foo,Format: F8.2,1 +rfoo,Format: F8.2,2 +ran003,Format: F8.2,3 +RAN001,"Label: RANK of foo +Format: F9.3",4 ]) AT_CLEANUP diff --git a/tests/perl-module.at b/tests/perl-module.at index 0ddd8fd5ff..e8b9524b1c 100644 --- a/tests/perl-module.at +++ b/tests/perl-module.at @@ -66,15 +66,9 @@ Documents in the active dataset: These Documents -Variable,Description,,Position -legal,Format: F9.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -money,Format: DOLLAR6.2,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +legal,Format: F9.2,1 +money,Format: DOLLAR6.2,2 dump-dict.sps:5: note: SHOW: WEIGHT is money. ]) @@ -143,15 +137,9 @@ DISPLAY DOCUMENTS. LIST. ]) AT_CHECK([pspp -O format=csv dump-dicts.sps], [0], - [Variable,Description,,Position -id,Format: F2.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -name,Format: A20,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 20,, + [Variable,Description,Position +id,Format: F2.0,1 +name,Format: A20,2 File label: This is the file label @@ -163,15 +151,9 @@ Table: Data List id,name 34,frederick @&t@ -Variable,Description,,Position -id,Format: F2.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -name,Format: A20,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 20,, +Variable,Description,Position +id,Format: F2.0,1 +name,Format: A20,2 File label: This is the file label @@ -236,30 +218,27 @@ AT_DATA([dump-dict.sps], DISPLAY DICTIONARY. ]) AT_CHECK([pspp -O format=csv dump-dict.sps], [0], - [Variable,Description,,Position -integer,Label: My Integer,,1 -,Format: F8.0,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,Missing Values: 9; 99,, -,0,Zero, -,1,Unity, -,2,Duality, -string,Label: My String,,2 -,Format: A8,, -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -,"Missing Values: ""this ""; ""that """,, -,xx ,foo, -,yy ,bar, -longstring,Label: My Long String,,3 -,Format: A9,, -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 9,, -,xxx ,xfoo, + [Variable,Description,Position +integer,"Label: My Integer +Format: F8.0 +Missing Values: 9; 99 + +Value,Label +0,Zero +1,Unity +2,Duality",1 +string,"Label: My String +Format: A8 +Missing Values: ""this ""; ""that "" + +Value,Label +xx ,foo +yy ,bar",2 +longstring,"Label: My Long String +Format: A9 + +Value,Label +xxx ,xfoo",3 ]) AT_CLEANUP @@ -456,51 +435,38 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -O format=csv dump-dicts.sps], [0], - [[Variable,Description,,Position -string,Label: A Short String Variable,,1 -,Format: A8,, -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -,"Missing Values: ""3333 """,, -,1111 ,ones, -,2222 ,twos, -,3333 ,threes, -longstring,Label: A Long String Variable,,2 -,Format: A12,, -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 12,, -numeric,Label: A Numeric Variable,,3 -,Format: F10.0,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,Missing Values: 9; 5; 999,, -,1,Unity, -,2,Duality, -,3,Thripality, -,Custom attributes:,, -,colour[1],blue, -,colour[2],pink, -,colour[3],violet, -,nationality,foreign, -,size,large, -date,Label: A Date Variable,,4 -,Format: DATE11,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -dollar,Label: A Dollar Variable,,5 -,Format: DOLLAR11.2,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -datetime,Label: A Datetime Variable,,6 -,Format: DATETIME17.0,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, + [[Variable,Description,Position +string,"Label: A Short String Variable +Format: A8 +Missing Values: ""3333 "" + +Value,Label +1111 ,ones +2222 ,twos +3333 ,threes",1 +longstring,"Label: A Long String Variable +Format: A12",2 +numeric,"Label: A Numeric Variable +Format: F10.0 +Missing Values: 9; 5; 999 + +Value,Label +1,Unity +2,Duality +3,Thripality + +Attribute,Value +colour[1],blue +colour[2],pink +colour[3],violet +nationality,foreign +size,large",3 +date,"Label: A Date Variable +Format: DATE11",4 +dollar,"Label: A Dollar Variable +Format: DOLLAR11.2",5 +datetime,"Label: A Datetime Variable +Format: DATETIME17.0",6 Table: Data List string,longstring,numeric,date,dollar,datetime @@ -510,51 +476,38 @@ string,longstring,numeric,date,dollar,datetime . ,. ,.,.,. ,. 5555 ,Five ,5,05-MAY-2005,$5.00,05-MAY-2005 05:05 -Variable,Description,,Position -string,Label: A Short String Variable,,1 -,Format: A8,, -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -,"Missing Values: ""3333 """,, -,1111 ,ones, -,2222 ,twos, -,3333 ,threes, -longstring,Label: A Long String Variable,,2 -,Format: A12,, -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 12,, -numeric,Label: A Numeric Variable,,3 -,Format: F10.0,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,Missing Values: 9; 5; 999,, -,1,Unity, -,2,Duality, -,3,Thripality, -,Custom attributes:,, -,colour[1],blue, -,colour[2],pink, -,colour[3],violet, -,nationality,foreign, -,size,large, -date,Label: A Date Variable,,4 -,Format: DATE11,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -dollar,Label: A Dollar Variable,,5 -,Format: DOLLAR11.2,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -datetime,Label: A Datetime Variable,,6 -,Format: DATETIME17.0,, -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Variable,Description,Position +string,"Label: A Short String Variable +Format: A8 +Missing Values: ""3333 "" + +Value,Label +1111 ,ones +2222 ,twos +3333 ,threes",1 +longstring,"Label: A Long String Variable +Format: A12",2 +numeric,"Label: A Numeric Variable +Format: F10.0 +Missing Values: 9; 5; 999 + +Value,Label +1,Unity +2,Duality +3,Thripality + +Attribute,Value +colour[1],blue +colour[2],pink +colour[3],violet +nationality,foreign +size,large",3 +date,"Label: A Date Variable +Format: DATE11",4 +dollar,"Label: A Dollar Variable +Format: DOLLAR11.2",5 +datetime,"Label: A Datetime Variable +Format: DATETIME17.0",6 Table: Data List string,longstring,numeric,date,dollar,datetime -- 2.30.2