more tests
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 4 Aug 2022 20:58:19 +0000 (13:58 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 4 Aug 2022 20:58:19 +0000 (13:58 -0700)
tests/automake.mk
tests/language/stats/ctables.at

index 24f3e5bc650393b44ab30cfafbc2d6b3654a5999..095ed03579ab3c280702c1d761f8b678c0e5dbb6 100644 (file)
@@ -488,8 +488,16 @@ $(srcdir)/tests/testsuite.at: tests/testsuite.in tests/automake.mk
 
 EXTRA_DIST += tests/testsuite.at
 
+# Generate a TableLook that prints all layers of pivot tables.
+check_DATA = tests/all-layers.stt
+tests/all-layers.stt: utilities/pspp-output
+       $(AM_V_GEN)$< get-table-look - $@.tmp
+       $(AM_V_at)if grep 'printAllLayers="false"' $@.tmp >/dev/null; then :; else \
+               echo >&2 "$<: expected printAllLayers=\"false\""; exit 1; fi
+       $(AM_v_at)sed 's/printAllLayers="false"/printAllLayers="true"/' < $@.tmp > $@
+
 CHECK_LOCAL += tests_check
-tests_check: tests/atconfig tests/atlocal $(TESTSUITE) $(check_PROGRAMS)
+tests_check: tests/atconfig tests/atlocal $(TESTSUITE) $(check_PROGRAMS) $(check_DATA)
        XTERM_LOCALE='' $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) RUNNER='$(RUNNER)' $(TESTSUITEFLAGS)
 
 CLEAN_LOCAL += tests_clean
index 0ab1b7c43937ee9b401890e4bd7143ce55ddf67c..ff60efa8df2ea8ec1bdc068a2719bc586506d617 100644 (file)
@@ -3,7 +3,6 @@ AT_BANNER([CTABLES])
 dnl Features not yet tested:
 dnl - Preprocessing to distinguish categorical from scale.
 dnl - Testing details of missing value handling in summaries.
-dnl - test CLABELS ROWLABELS=LAYER.
 dnl - Test VLABELS.
 dnl - Test WEIGHT and adjustment weights.
 dnl - Summary functions:
@@ -1573,10 +1572,31 @@ 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.
 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
+CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
+CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
 ]])
-AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
+pwd
+AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
+             Custom Tables
+╭───────────────────────┬────────────╮
+│                       │S3a. GENDER:│
+│                       ├─────┬──────┤
+│                       │ Male│Female│
+│                       ├─────┼──────┤
+│                       │Count│ Count│
+├───────────────────────┼─────┼──────┤
+│Age group 15 or younger│    0│     0│
+│          16 to 25     │  594│   505│
+│          26 to 35     │  476│   491│
+│          36 to 45     │  489│   548│
+│          46 to 55     │  526│   649│
+│          56 to 65     │  516│   731│
+│          66 or older  │  531│   943│
+╰───────────────────────┴─────┴──────╯
+
                                                       Custom Tables
 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
 │       │                                                 S3a. GENDER:                                                 │
@@ -1619,6 +1639,122 @@ AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
 │          66 or older   Male  │         531│
 │                        Female│         943│
 ╰──────────────────────────────┴────────────╯
+
+      Custom Tables
+15 or younger
+╭─────────┬────────────╮
+│         │S3a. GENDER:│
+│         ├─────┬──────┤
+│         │ Male│Female│
+│         ├─────┼──────┤
+│         │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│    0│     0│
+╰─────────┴─────┴──────╯
+
+      Custom Tables
+16 to 25
+╭─────────┬────────────╮
+│         │S3a. GENDER:│
+│         ├─────┬──────┤
+│         │ Male│Female│
+│         ├─────┼──────┤
+│         │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│  594│   505│
+╰─────────┴─────┴──────╯
+
+      Custom Tables
+26 to 35
+╭─────────┬────────────╮
+│         │S3a. GENDER:│
+│         ├─────┬──────┤
+│         │ Male│Female│
+│         ├─────┼──────┤
+│         │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│  476│   491│
+╰─────────┴─────┴──────╯
+
+      Custom Tables
+36 to 45
+╭─────────┬────────────╮
+│         │S3a. GENDER:│
+│         ├─────┬──────┤
+│         │ Male│Female│
+│         ├─────┼──────┤
+│         │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│  489│   548│
+╰─────────┴─────┴──────╯
+
+      Custom Tables
+46 to 55
+╭─────────┬────────────╮
+│         │S3a. GENDER:│
+│         ├─────┬──────┤
+│         │ Male│Female│
+│         ├─────┼──────┤
+│         │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│  526│   649│
+╰─────────┴─────┴──────╯
+
+      Custom Tables
+56 to 65
+╭─────────┬────────────╮
+│         │S3a. GENDER:│
+│         ├─────┬──────┤
+│         │ Male│Female│
+│         ├─────┼──────┤
+│         │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│  516│   731│
+╰─────────┴─────┴──────╯
+
+      Custom Tables
+66 or older
+╭─────────┬────────────╮
+│         │S3a. GENDER:│
+│         ├─────┬──────┤
+│         │ Male│Female│
+│         ├─────┼──────┤
+│         │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│  531│   943│
+╰─────────┴─────┴──────╯
+
+             Custom Tables
+Male
+╭───────────────────────┬────────────╮
+│                       │S3a. GENDER:│
+│                       ├────────────┤
+│                       │    Count   │
+├───────────────────────┼────────────┤
+│Age group 15 or younger│           0│
+│          16 to 25     │         594│
+│          26 to 35     │         476│
+│          36 to 45     │         489│
+│          46 to 55     │         526│
+│          56 to 65     │         516│
+│          66 or older  │         531│
+╰───────────────────────┴────────────╯
+
+             Custom Tables
+Female
+╭───────────────────────┬────────────╮
+│                       │S3a. GENDER:│
+│                       ├────────────┤
+│                       │    Count   │
+├───────────────────────┼────────────┤
+│Age group 15 or younger│           0│
+│          16 to 25     │         505│
+│          26 to 35     │         491│
+│          36 to 45     │         548│
+│          46 to 55     │         649│
+│          56 to 65     │         731│
+│          66 or older  │         943│
+╰───────────────────────┴────────────╯
 ])
 AT_CLEANUP