Fix bug in CLABELS when a missing category was moved, and add test.
[pspp] / tests / language / stats / ctables.at
index e19007e65e17d3a6b7c0620c6b2abb0d2f0890fa..ec89cab1a56507f48a07f7c873711a7afe7873a5 100644 (file)
@@ -860,3 +860,56 @@ AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
 ])
 AT_CLEANUP
+
+AT_SETUP([CTABLES CLABELS])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
+CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
+                                                      Custom Tables
+╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
+│       │                                                 S3a. GENDER:                                                 │
+│       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
+│       │                         Male                         │                         Female                        │
+│       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
+│       │  15 or  │ 16 to │ 26 to│ 36 to│ 46 to│ 56 to │ 66 or │   15 or  │ 16 to│ 26 to │ 36 to│ 46 to│ 56 to│  66 or │
+│       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
+│       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
+│       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
+├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
+│Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
+│group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
+╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
+
+                Custom Tables
+╭──────────────────────────────┬────────────╮
+│                              │S3a. GENDER:│
+│                              ├────────────┤
+│                              │    Count   │
+├──────────────────────────────┼────────────┤
+│Age group 15 or younger Male  │           0│
+│                        Female│           0│
+│         ╶────────────────────┼────────────┤
+│          16 to 25      Male  │         594│
+│                        Female│         505│
+│         ╶────────────────────┼────────────┤
+│          26 to 35      Male  │         476│
+│                        Female│         491│
+│         ╶────────────────────┼────────────┤
+│          36 to 45      Male  │         489│
+│                        Female│         548│
+│         ╶────────────────────┼────────────┤
+│          46 to 55      Male  │         526│
+│                        Female│         649│
+│         ╶────────────────────┼────────────┤
+│          56 to 65      Male  │         516│
+│                        Female│         731│
+│         ╶────────────────────┼────────────┤
+│          66 or older   Male  │         531│
+│                        Female│         943│
+╰──────────────────────────────┴────────────╯
+])
+AT_CLEANUP
\ No newline at end of file