A few basic tests pass.
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 AT_SETUP([CTABLES parsing])
4 AT_DATA([ctables.sps],
5 [[DATA LIST LIST NOTABLE /x y z.
6 CTABLES /TABLE=(x + y) > z.
7 CTABLES /TABLE=(x[c] + y[c]) > z.
8 CTABLES /TABLE=(x + y) > z[c].
9 CTABLES /TABLE=x BY y BY z.
10 CTABLES /TABLE=x[c] [ROWPCT.COUNT] > y[c].
11 CTABLES /TABLE=x[c] > y[c] [ROWPCT.COUNT].
12 ]])
13 AT_CHECK([pspp ctables.sps])
14 AT_CLEANUP
15
16 AT_SETUP([CTABLES one categorical variable])
17 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
18 AT_DATA([ctables.sps],
19 [[GET 'nhtsa.sav'.
20 CTABLES /TABLE QN1.
21 CTABLES /TABLE BY QN1.
22 CTABLES /TABLE BY BY QN1.
23 ]])
24 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
25                                   Custom Tables
26 ╭────────────────────────────────────────────────────────────────────────┬─────╮
27 │                                                                        │Count│
28 ├────────────────────────────────────────────────────────────────────────┼─────┤
29 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
30 │motor vehicle?                                     Several days a week  │ 1274│
31 │                                                   Once a week or less  │  361│
32 │                                                   Only certain times a │  130│
33 │                                                   year                 │     │
34 │                                                   Never                │  540│
35 ╰────────────────────────────────────────────────────────────────────────┴─────╯
36
37                                   Custom Tables
38 ╭──────────────────────────────────────────────────────────────────────────────╮
39 │        1. How often do you usually drive a car or other motor vehicle?       │
40 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
41 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
42 │Every day│       week       │       less       │          year          │Never│
43 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
44 │  Count  │       Count      │       Count      │          Count         │Count│
45 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
46 │     4667│              1274│               361│                     130│  540│
47 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
48
49 Custom Tables
50 Every day
51 ╭─────╮
52 │Count│
53 ├─────┤
54 │ 4667│
55 ╰─────╯
56 ])
57 AT_CLEANUP
58
59 AT_SETUP([CTABLES one scale variable])
60 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
61 AT_DATA([ctables.sps],
62 [[GET 'nhtsa.sav'.
63 CTABLES /TABLE QND1[COUNT, MEAN, STDDEV, MINIMUM, MAXIMUM].
64 CTABLES /TABLE BY QND1.
65 CTABLES /TABLE BY BY QND1.
66 ]])
67 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
68                             Custom Tables
69 ╭──────────────────────────┬─────┬────┬─────────────┬───────┬───────╮
70 │                          │Count│Mean│Std Deviation│Minimum│Maximum│
71 ├──────────────────────────┼─────┼────┼─────────────┼───────┼───────┤
72 │D1. AGE: What is your age?│ 6930│  48│           19│     16│     86│
73 ╰──────────────────────────┴─────┴────┴─────────────┴───────┴───────╯
74
75         Custom Tables
76 ╭──────────────────────────╮
77 │D1. AGE: What is your age?│
78 ├──────────────────────────┤
79 │           Mean           │
80 ├──────────────────────────┤
81 │                        48│
82 ╰──────────────────────────╯
83
84 Custom Tables
85 D1. AGE: What is your age?
86 ╭────╮
87 │Mean│
88 ├────┤
89 │  48│
90 ╰────╯
91 ])
92 AT_CLEANUP