CTABLES fix DISPLAY=NONE for scale variable names
[pspp] / tests / language / stats / ctables.at
index 26ff5f9de52866d94c6f7c3e1dbd52c64bf31b37..5f8120c69bf1d1c3588c27b9bb5a81e9ad1dc7bc 100644 (file)
@@ -3230,16 +3230,91 @@ AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
 AT_CLEANUP
 
 
-AT_SETUP([CTABLES scale summary functions - assertion failure])
+AT_SETUP([CTABLES hidden scale VLABELS])
 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
 AT_DATA([ctables.sps],
 [[GET 'nhtsa.sav'.
+CTABLES
+    /TABLE region BY qn19a + qn35
+    /SLABELS POSITION=ROW.
 CTABLES
     /VLABELS VARIABLE=qn19a DISPLAY=NONE
-    /TABLE region BY qn19a
-    /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
+    /TABLE region BY qn19a + qn35
+    /SLABELS POSITION=ROW.
+CTABLES
+    /VLABELS VARIABLE=qn35 DISPLAY=NONE
+    /TABLE region BY qn19a + qn35
+    /SLABELS POSITION=ROW.
+
+* This one in particular caused a crash because no categories were
+  created on the column axis, so passing in 0 for the index was still
+  too big for that number of categories.  It was fixed by creating a
+  name-only category for each variable despite the "NONE" request,
+  then hiding the entire dimension's labels if all its labels were
+  set to "NONE".
+CTABLES
+    /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
+    /TABLE region BY qn19a + qn35
     /SLABELS POSITION=ROW.
 ]])
-AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [])
+AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
+                                 Custom Tables
+╭──────────────┬────────────────────────────┬─────────────────────────────────╮
+│              │ 19a. About how old were you│ 35. In the past thirty days, how│
+│              │   when you first starting  │   many times have you driven a  │
+│              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
+│              │  counting small tastes or  │     AFTER drinking alcoholic    │
+│              │      sips of alcohol.      │            beverages?           │
+├──────────────┼────────────────────────────┼─────────────────────────────────┤
+│Region NE Mean│                       19.33│                                2│
+│      ╶───────┼────────────────────────────┼─────────────────────────────────┤
+│       MW Mean│                       19.83│                                2│
+│      ╶───────┼────────────────────────────┼─────────────────────────────────┤
+│       S  Mean│                       20.29│                                2│
+│      ╶───────┼────────────────────────────┼─────────────────────────────────┤
+│       W  Mean│                       19.87│                                2│
+╰──────────────┴────────────────────────────┴─────────────────────────────────╯
+
+                                 Custom Tables
+╭──────────────┬─────┬────────────────────────────────────────────────────────╮
+│              │     │  35. In the past thirty days, how many times have you  │
+│              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
+│              │QN19A│                  alcoholic beverages?                  │
+├──────────────┼─────┼────────────────────────────────────────────────────────┤
+│Region NE Mean│19.33│                                                       2│
+│      ╶───────┼─────┼────────────────────────────────────────────────────────┤
+│       MW Mean│19.83│                                                       2│
+│      ╶───────┼─────┼────────────────────────────────────────────────────────┤
+│       S  Mean│20.29│                                                       2│
+│      ╶───────┼─────┼────────────────────────────────────────────────────────┤
+│       W  Mean│19.87│                                                       2│
+╰──────────────┴─────┴────────────────────────────────────────────────────────╯
+
+                                 Custom Tables
+╭──────────────┬─────────────────────────────────────────────────────────┬────╮
+│              │   19a. About how old were you when you first starting   │    │
+│              │  drinking alcohol, not counting small tastes or sips of │    │
+│              │                         alcohol.                        │qn35│
+├──────────────┼─────────────────────────────────────────────────────────┼────┤
+│Region NE Mean│                                                    19.33│   2│
+│      ╶───────┼─────────────────────────────────────────────────────────┼────┤
+│       MW Mean│                                                    19.83│   2│
+│      ╶───────┼─────────────────────────────────────────────────────────┼────┤
+│       S  Mean│                                                    20.29│   2│
+│      ╶───────┼─────────────────────────────────────────────────────────┼────┤
+│       W  Mean│                                                    19.87│   2│
+╰──────────────┴─────────────────────────────────────────────────────────┴────╯
+
+      Custom Tables
+╭──────────────┬───────╮
+│Region NE Mean│19.33 2│
+│      ╶───────┼───────┤
+│       MW Mean│19.83 2│
+│      ╶───────┼───────┤
+│       S  Mean│20.29 2│
+│      ╶───────┼───────┤
+│       W  Mean│19.87 2│
+╰──────────────┴───────╯
+])
 AT_CLEANUP