pivot-output: When there's no dimension border, use the category border.
[pspp] / tests / output / pivot-table.at
1 AT_BANNER([pivot table rendering])
2
3 AT_SETUP([1-d pivot table])
4 AT_DATA([pivot.txt], [[
5 /col "a"*("a1", "a2", "a3")
6 /cell[all]
7 /title "Columns" /display
8 /title "Rows" /transpose.
9 ]])
10 AT_DATA([expout], [dnl
11 Columns
12 ╭────────╮
13 │    a   │
14 ├──┬──┬──┤
15 │a1│a2│a3│
16 ├──┼──┼──┤
17 │ 0│ 1│ 2│
18 ╰──┴──┴──╯
19
20 Rows
21 ╭──┬─╮
22 │a │ │
23 ├──┼─┤
24 │a1│0│
25 │a2│1│
26 │a3│2│
27 ╰──┴─╯
28 ])
29 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
30 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
31 AT_CLEANUP
32
33 AT_SETUP([2-d pivot table])
34 AT_DATA([pivot.txt], [[
35 /col "a"("a1", "a2", "a3")
36 /col "b"("b1", "b2", "b3")
37 /cell[all, all]
38 /title "Columns" /display
39 /title "Rows" /transpose /display
40 /title "Column x Row" /move "a" column /display
41 /title "Row x Column" /transpose
42 ]])
43 AT_DATA([expout], [dnl
44 Columns
45 ╭────────┬────────┬────────╮
46 │   b1   │   b2   │   b3   │
47 ├──┬──┬──┼──┬──┬──┼──┬──┬──┤
48 │a1│a2│a3│a1│a2│a3│a1│a2│a3│
49 ├──┼──┼──┼──┼──┼──┼──┼──┼──┤
50 │ 0│ 1│ 2│ 3│ 4│ 5│ 6│ 7│ 8│
51 ╰──┴──┴──┴──┴──┴──┴──┴──┴──╯
52
53 Rows
54 ╭─────┬─╮
55 │b1 a1│0│
56 │   a2│1│
57 │   a3│2│
58 ├─────┼─┤
59 │b2 a1│3│
60 │   a2│4│
61 │   a3│5│
62 ├─────┼─┤
63 │b3 a1│6│
64 │   a2│7│
65 │   a3│8│
66 ╰─────┴─╯
67
68 Column x Row
69 ╭──┬──┬──┬──╮
70 │  │a1│a2│a3│
71 ├──┼──┼──┼──┤
72 │b1│ 0│ 1│ 2│
73 │b2│ 3│ 4│ 5│
74 │b3│ 6│ 7│ 8│
75 ╰──┴──┴──┴──╯
76
77 Row x Column
78 ╭──┬──┬──┬──╮
79 │  │b1│b2│b3│
80 ├──┼──┼──┼──┤
81 │a1│ 0│ 3│ 6│
82 │a2│ 1│ 4│ 7│
83 │a3│ 2│ 5│ 8│
84 ╰──┴──┴──┴──╯
85 ])
86 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
87 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
88 AT_CLEANUP
89
90 AT_SETUP([2-d pivot table - dimension labels])
91 AT_DATA([pivot.txt], [[
92 /col "a"*("a1", "a2", "a3")
93 /col "b"*("b1", "b2", "b3")
94 /cell[all, all]
95 /title "Columns" /display
96 /title "Rows - Corner" /transpose /display
97 /title "Rows - Nested" /look rowlabels=nested /display
98 /title "Column x Row - Corner" /move "a" column /look rowlabels=corner /display
99 /title "Column x Row - Nested" /look rowlabels=nested /display
100 /title "Row x Column - Corner" /transpose /look rowlabels=corner /display
101 /title "Row x Column - Nested" /look rowlabels=nested
102 ]])
103 AT_DATA([expout], [dnl
104 Columns
105 ╭──────────────────────────╮
106 │             b            │
107 ├────────┬────────┬────────┤
108 │   b1   │   b2   │   b3   │
109 ├────────┼────────┼────────┤
110 │    a   │    a   │    a   │
111 ├──┬──┬──┼──┬──┬──┼──┬──┬──┤
112 │a1│a2│a3│a1│a2│a3│a1│a2│a3│
113 ├──┼──┼──┼──┼──┼──┼──┼──┼──┤
114 │ 0│ 1│ 2│ 3│ 4│ 5│ 6│ 7│ 8│
115 ╰──┴──┴──┴──┴──┴──┴──┴──┴──╯
116
117 Rows - Corner
118 ╭─────┬─╮
119 │b  a │ │
120 ├─────┼─┤
121 │b1 a1│0│
122 │   a2│1│
123 │   a3│2│
124 ├─────┼─┤
125 │b2 a1│3│
126 │   a2│4│
127 │   a3│5│
128 ├─────┼─┤
129 │b3 a1│6│
130 │   a2│7│
131 │   a3│8│
132 ╰─────┴─╯
133
134 Rows - Nested
135 ╭─────────┬─╮
136 │b b1 a a1│0│
137 │       a2│1│
138 │       a3│2│
139 │ ╶───────┼─┤
140 │  b2 a a1│3│
141 │       a2│4│
142 │       a3│5│
143 │ ╶───────┼─┤
144 │  b3 a a1│6│
145 │       a2│7│
146 │       a3│8│
147 ╰─────────┴─╯
148
149 Column x Row - Corner
150 ╭──┬────────╮
151 │  │    a   │
152 │  ├──┬──┬──┤
153 │b │a1│a2│a3│
154 ├──┼──┼──┼──┤
155 │b1│ 0│ 1│ 2│
156 │b2│ 3│ 4│ 5│
157 │b3│ 6│ 7│ 8│
158 ╰──┴──┴──┴──╯
159
160 Column x Row - Nested
161 ╭────┬────────╮
162 │    │    a   │
163 │    ├──┬──┬──┤
164 │    │a1│a2│a3│
165 ├────┼──┼──┼──┤
166 │b b1│ 0│ 1│ 2│
167 │  b2│ 3│ 4│ 5│
168 │  b3│ 6│ 7│ 8│
169 ╰────┴──┴──┴──╯
170
171 Row x Column - Corner
172 ╭──┬────────╮
173 │  │    b   │
174 │  ├──┬──┬──┤
175 │a │b1│b2│b3│
176 ├──┼──┼──┼──┤
177 │a1│ 0│ 3│ 6│
178 │a2│ 1│ 4│ 7│
179 │a3│ 2│ 5│ 8│
180 ╰──┴──┴──┴──╯
181
182 Row x Column - Nested
183 ╭────┬────────╮
184 │    │    b   │
185 │    ├──┬──┬──┤
186 │    │b1│b2│b3│
187 ├────┼──┼──┼──┤
188 │a a1│ 0│ 3│ 6│
189 │  a2│ 1│ 4│ 7│
190 │  a3│ 2│ 5│ 8│
191 ╰────┴──┴──┴──╯
192 ])
193 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
194 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
195 AT_CLEANUP
196
197 AT_SETUP([2-d pivot table - groups])
198 AT_DATA([pivot.txt], [[
199 /col "a"("a1", "ag1"("a2", "a3"))
200 /col "b"("bg1"("b1", "b2"), "b3")
201 /cell[all, all]
202 /title "Columns" /display
203 /title "Rows" /transpose /display
204 /title "Column x Row" /move "a" column /display
205 /title "Row x Column" /transpose /display
206 /title "Row x Column - delete b2" /cells[all,1]=delete /display
207 /title "Row x Column - delete b2 - show empty" /look empty=show /display
208 /title "Row x Column - delete b1" /cells[all,0]=delete /look empty=hide /display
209 /title "Row x Column - delete b1 - show empty" /look empty=show.
210 ]])
211 AT_DATA([expout], [dnl
212 Columns
213 ╭─────────────────┬────────╮
214 │       bg1       │        │
215 ├────────┬────────┤        │
216 │   b1   │   b2   │   b3   │
217 ├──┬─────┼──┬─────┼──┬─────┤
218 │  │ ag1 │  │ ag1 │  │ ag1 │
219 │  ├──┬──┤  ├──┬──┤  ├──┬──┤
220 │a1│a2│a3│a1│a2│a3│a1│a2│a3│
221 ├──┼──┼──┼──┼──┼──┼──┼──┼──┤
222 │ 0│ 1│ 2│ 3│ 4│ 5│ 6│ 7│ 8│
223 ╰──┴──┴──┴──┴──┴──┴──┴──┴──╯
224
225 Rows
226 ╭─────────────┬─╮
227 │bg1 b1 a1    │0│
228 │      ╶──────┼─┤
229 │       ag1 a2│1│
230 │           a3│2│
231 │   ╶─────────┼─┤
232 │    b2 a1    │3│
233 │      ╶──────┼─┤
234 │       ag1 a2│4│
235 │           a3│5│
236 ├─────────────┼─┤
237 │b3     a1    │6│
238 │      ╶──────┼─┤
239 │       ag1 a2│7│
240 │           a3│8│
241 ╰─────────────┴─╯
242
243 Column x Row
244 ╭──────┬──┬─────╮
245 │      │  │ ag1 │
246 │      │  ├──┬──┤
247 │      │a1│a2│a3│
248 ├──────┼──┼──┼──┤
249 │bg1 b1│ 0│ 1│ 2│
250 │    b2│ 3│ 4│ 5│
251 ├──────┼──┼──┼──┤
252 │b3    │ 6│ 7│ 8│
253 ╰──────┴──┴──┴──╯
254
255 Row x Column
256 ╭──────┬─────┬──╮
257 │      │ bg1 │  │
258 │      ├──┬──┤  │
259 │      │b1│b2│b3│
260 ├──────┼──┼──┼──┤
261 │a1    │ 0│ 3│ 6│
262 ├──────┼──┼──┼──┤
263 │ag1 a2│ 1│ 4│ 7│
264 │    a3│ 2│ 5│ 8│
265 ╰──────┴──┴──┴──╯
266
267 Row x Column - delete b2
268 ╭──────┬───┬──╮
269 │      │bg1│  │
270 │      ├───┤  │
271 │      │ b1│b3│
272 ├──────┼───┼──┤
273 │a1    │  0│ 6│
274 ├──────┼───┼──┤
275 │ag1 a2│  1│ 7│
276 │    a3│  2│ 8│
277 ╰──────┴───┴──╯
278
279 Row x Column - delete b2 - show empty
280 ╭──────┬─────┬──╮
281 │      │ bg1 │  │
282 │      ├──┬──┤  │
283 │      │b1│b2│b3│
284 ├──────┼──┼──┼──┤
285 │a1    │ 0│  │ 6│
286 ├──────┼──┼──┼──┤
287 │ag1 a2│ 1│  │ 7│
288 │    a3│ 2│  │ 8│
289 ╰──────┴──┴──┴──╯
290
291 Row x Column - delete b1
292 ╭──────┬──╮
293 │      │b3│
294 ├──────┼──┤
295 │a1    │ 6│
296 ├──────┼──┤
297 │ag1 a2│ 7│
298 │    a3│ 8│
299 ╰──────┴──╯
300
301 Row x Column - delete b1 - show empty
302 ╭──────┬─────┬──╮
303 │      │ bg1 │  │
304 │      ├──┬──┤  │
305 │      │b1│b2│b3│
306 ├──────┼──┼──┼──┤
307 │a1    │  │  │ 6│
308 ├──────┼──┼──┼──┤
309 │ag1 a2│  │  │ 7│
310 │    a3│  │  │ 8│
311 ╰──────┴──┴──┴──╯
312 ])
313 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
314 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
315 AT_CLEANUP
316
317 AT_SETUP([2-d pivot table - layers])
318 AT_DATA([pivot.txt], [[
319 /col "a"("a1", "a2", "a3")
320 /layer "b"("b1", "b2", "b3")
321 /cell[all, all]
322 /title "Column x b1" /display
323 /title "Row x b1" /transpose /display
324 /title "Column x b2" /show layer 1 /transpose /display
325 /title "Row x b2" /transpose /display
326 /title "Column (All Layers)" /look layers=all /display
327 /title "Row (All Layers)" /transpose /look layers=all
328 ]])
329 AT_DATA([expout], [dnl
330 Column x b1
331 b1
332 ╭──┬──┬──╮
333 │a1│a2│a3│
334 ├──┼──┼──┤
335 │ 0│ 1│ 2│
336 ╰──┴──┴──╯
337
338 Row x b1
339 b1
340 ╭──┬─╮
341 │a1│0│
342 │a2│1│
343 │a3│2│
344 ╰──┴─╯
345
346 Column x b2
347 b2
348 ╭──┬──┬──╮
349 │a1│a2│a3│
350 ├──┼──┼──┤
351 │ 3│ 4│ 5│
352 ╰──┴──┴──╯
353
354 Row x b2
355 b2
356 ╭──┬─╮
357 │a1│3│
358 │a2│4│
359 │a3│5│
360 ╰──┴─╯
361
362 Column (All Layers)
363 b1
364 ╭──┬─╮
365 │a1│0│
366 │a2│1│
367 │a3│2│
368 ╰──┴─╯
369
370 Column (All Layers)
371 b2
372 ╭──┬─╮
373 │a1│3│
374 │a2│4│
375 │a3│5│
376 ╰──┴─╯
377
378 Column (All Layers)
379 b3
380 ╭──┬─╮
381 │a1│6│
382 │a2│7│
383 │a3│8│
384 ╰──┴─╯
385
386 Row (All Layers)
387 b1
388 ╭──┬──┬──╮
389 │a1│a2│a3│
390 ├──┼──┼──┤
391 │ 0│ 1│ 2│
392 ╰──┴──┴──╯
393
394 Row (All Layers)
395 b2
396 ╭──┬──┬──╮
397 │a1│a2│a3│
398 ├──┼──┼──┤
399 │ 3│ 4│ 5│
400 ╰──┴──┴──╯
401
402 Row (All Layers)
403 b3
404 ╭──┬──┬──╮
405 │a1│a2│a3│
406 ├──┼──┼──┤
407 │ 6│ 7│ 8│
408 ╰──┴──┴──╯
409 ])
410 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
411 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
412 AT_CLEANUP
413
414 AT_SETUP([3-d pivot table - layers])
415 AT_DATA([pivot.txt], [[
416 /layer "a"("a1", "a2", "a3")
417 /layer "b"("b1", "b2", "b3", "b4")
418 /col "c"("c1", "c2", "c3", "c4", "c5")
419 /cell[all, all, all]
420 /title "Column x b1 x a1" /display
421 /title "Column x b2 x a1" /show layer 0 1 /display
422 /title "Column x b3 x a2" /show layer 1 2 /display
423 ]])
424 AT_DATA([expout], [dnl
425 Column x b1 x a1
426 b1
427 a1
428 ╭──┬──┬──┬──┬──╮
429 │c1│c2│c3│c4│c5│
430 ├──┼──┼──┼──┼──┤
431 │ 0│12│24│36│48│
432 ╰──┴──┴──┴──┴──╯
433
434 Column x b2 x a1
435 b2
436 a1
437 ╭──┬──┬──┬──┬──╮
438 │c1│c2│c3│c4│c5│
439 ├──┼──┼──┼──┼──┤
440 │ 3│15│27│39│51│
441 ╰──┴──┴──┴──┴──╯
442
443 Column x b3 x a2
444 b3
445 a2
446 ╭──┬──┬──┬──┬──╮
447 │c1│c2│c3│c4│c5│
448 ├──┼──┼──┼──┼──┤
449 │ 7│19│31│43│55│
450 ╰──┴──┴──┴──┴──╯
451 ])
452 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
453 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
454 AT_CLEANUP
455
456 AT_SETUP([pivot table title and caption])
457 AT_DATA([pivot.txt], [[
458 /col "a"("a1", "a2")
459 /row "b"("b1", "b2")
460 /cell[all, all]
461 /title "Title + Caption" /caption "Title + Caption" /display
462 /title "Title Only" /caption "(Not Shown)" /show title=yes caption=no /display
463 /title "(Not Shown)" /caption "Caption Only" /show title=no caption=yes /display
464 /title "(Not Shown)" /caption "(Not Shown)" /show title=no caption=no
465 ]])
466 AT_DATA([expout], [dnl
467 Title + Caption
468 ╭──┬──┬──╮
469 │  │a1│a2│
470 ├──┼──┼──┤
471 │b1│ 0│ 1│
472 │b2│ 2│ 3│
473 ╰──┴──┴──╯
474 Title + Caption
475
476 Title Only
477 ╭──┬──┬──╮
478 │  │a1│a2│
479 ├──┼──┼──┤
480 │b1│ 0│ 1│
481 │b2│ 2│ 3│
482 ╰──┴──┴──╯
483
484 ╭──┬──┬──╮
485 │  │a1│a2│
486 ├──┼──┼──┤
487 │b1│ 0│ 1│
488 │b2│ 2│ 3│
489 ╰──┴──┴──╯
490 Caption Only
491
492 ╭──┬──┬──╮
493 │  │a1│a2│
494 ├──┼──┼──┤
495 │b1│ 0│ 1│
496 │b2│ 2│ 3│
497 ╰──┴──┴──╯
498 ])
499 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
500 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
501 AT_CLEANUP
502
503 AT_SETUP([pivot table footnotes])
504 AT_KEYWORDS([footnote])
505 AT_DATA([pivot.txt], [[
506 /footnote[0] "First footnote" marker="*"
507 /footnote[1] "Second footnote"
508 /col "A"[footnote 0]*("B"[footnote 1], "C"[footnote 0 1])
509 /row "D"[footnote 1]*("E"[footnote 0], "F"[footnote 1 0])
510 /look rowlabels=nested
511 /cell[0, 0]=0
512 /cell[1, 0]=1[footnote 0]
513 /cell[0, 1]=2[footnote 1]
514 /cell[1, 1]=3[footnote 0 1]
515 /caption "Caption"[footnote 0]
516 /corner "Corner"[footnote 0 1]
517 /title "Pivot Table with Alphabetic Subscript Footnotes"[footnote 0]
518 /look marker=alpha level=sub
519 /display
520 /title "Pivot Table with Alphabetic Superscript Footnotes"[footnote 0]
521 /look marker=alpha level=super
522 /display
523 /title "Pivot Table with Numeric Subscript Footnotes"[footnote 0]
524 /look marker=numeric level=sub
525 /display
526 /title "Pivot Table with Numeric Superscript Footnotes"[footnote 0]
527 /look marker=numeric level=super
528 /display
529 /title "Hidden Footnote"[footnote 0]
530 /footnote[0] "First footnote" marker="*" hide
531 ]])
532 AT_DATA([expout],
533 [[Pivot Table with Alphabetic Subscript Footnotes[*]
534 ╭────────────┬──────────────────╮
535 │            │       A[*]       │
536 │            ├───────┬──────────┤
537 │Corner[*][b]│  B[b] │  C[*][b] │
538 ├────────────┼───────┼──────────┤
539 │D[b] E[*]   │    .00│   1.00[*]│
540 │     F[*][b]│2.00[b]│3.00[*][b]│
541 ╰────────────┴───────┴──────────╯
542 Caption[*]
543 *. First footnote
544 b. Second footnote
545
546 Pivot Table with Alphabetic Superscript Footnotes[*]
547 ╭────────────┬──────────────────╮
548 │            │       A[*]       │
549 │            ├───────┬──────────┤
550 │Corner[*][b]│  B[b] │  C[*][b] │
551 ├────────────┼───────┼──────────┤
552 │D[b] E[*]   │    .00│   1.00[*]│
553 │     F[*][b]│2.00[b]│3.00[*][b]│
554 ╰────────────┴───────┴──────────╯
555 Caption[*]
556 *. First footnote
557 b. Second footnote
558
559 Pivot Table with Numeric Subscript Footnotes[*]
560 ╭────────────┬──────────────────╮
561 │            │       A[*]       │
562 │            ├───────┬──────────┤
563 │Corner[*][2]│  B[2] │  C[*][2] │
564 ├────────────┼───────┼──────────┤
565 │D[2] E[*]   │    .00│   1.00[*]│
566 │     F[*][2]│2.00[2]│3.00[*][2]│
567 ╰────────────┴───────┴──────────╯
568 Caption[*]
569 *. First footnote
570 2. Second footnote
571
572 Pivot Table with Numeric Superscript Footnotes[*]
573 ╭────────────┬──────────────────╮
574 │            │       A[*]       │
575 │            ├───────┬──────────┤
576 │Corner[*][2]│  B[2] │  C[*][2] │
577 ├────────────┼───────┼──────────┤
578 │D[2] E[*]   │    .00│   1.00[*]│
579 │     F[*][2]│2.00[2]│3.00[*][2]│
580 ╰────────────┴───────┴──────────╯
581 Caption[*]
582 *. First footnote
583 2. Second footnote
584
585 Hidden Footnote[*]
586 ╭────────────┬──────────────────╮
587 │            │       A[*]       │
588 │            ├───────┬──────────┤
589 │Corner[*][2]│  B[2] │  C[*][2] │
590 ├────────────┼───────┼──────────┤
591 │D[2] E[*]   │    .00│   1.00[*]│
592 │     F[*][2]│2.00[2]│3.00[*][2]│
593 ╰────────────┴───────┴──────────╯
594 Caption[*]
595 2. Second footnote
596 ]])
597 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
598 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
599 AT_CLEANUP
600
601 AT_SETUP([pivot table with no dimensions])
602 AT_DATA([pivot.txt], [[
603 /title "No Dimensions"
604 ]])
605 AT_DATA([expout], [dnl
606 No Dimensions
607 ╭╮
608 ╰╯
609 ])
610 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
611 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
612 AT_CLEANUP
613
614 AT_SETUP([pivot table with empty dimensions])
615 AT_DATA([pivot.txt], [[
616 /col "a"()
617 /look empty=show
618 /title "One Empty Dimension" /display
619 /title "Two Empty Dimensions" /row "b"*() /display
620 /title "Three Dimensions, Two Empty" /row "c"("c1", "c2")
621 ]])
622 AT_DATA([expout], [dnl
623 One Empty Dimension
624
625 Two Empty Dimensions
626
627 Three Dimensions, Two Empty
628 ])
629 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
630 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
631 AT_CLEANUP
632
633 AT_SETUP([pivot table with empty groups])
634 AT_DATA([pivot.txt], [[
635 /col "a"("a1", "a2"(), "a3")
636 /row "b"("b1"(), "b2", "b3")
637 /cell[all,all]
638 /look empty=show
639 /display
640 ]])
641 AT_DATA([expout], [dnl
642 Default Title
643 ╭──┬──┬──╮
644 │  │a1│a3│
645 ├──┼──┼──┤
646 │b2│ 0│ 1│
647 │b3│ 2│ 3│
648 ╰──┴──┴──╯
649 ])
650 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
651 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
652 AT_CLEANUP
653
654 AT_SETUP([pivot table - category and dimension borders 1])
655 AT_DATA([pivot.txt], [[
656 /col "a"*("a1", "ag1"("a2", "a3"))
657 /col "b"*("bg1"("b1", "b2"), "b3")
658 /row "c"*("c1", "cg1"("c2", "c3"))
659 /row "d"*("dg1"("d1", "d2"), "d3")
660 /cell[all, all, all, all]
661 /border "*" (none)
662 /border "dim-row-horz" (solid "blue")
663 /border "dim-col-vert" (solid "blue")
664 /title "Dimension Borders 1"
665 /display
666 /border "*" (none)
667 /border "cat-row-horz" (dashed "red")
668 /border "cat-col-vert" (dashed "red")
669 /title "Category Borders 1"
670 /display
671 /border "*" (none)
672 /border "dim-row-horz" (solid "blue")
673 /border "dim-col-vert" (solid "blue")
674 /border "cat-row-horz" (dashed "red")
675 /border "cat-col-vert" (dashed "red")
676 /title "Category and Dimension Borders 1"
677 ]])
678 AT_DATA([expout], [dnl
679 Dimension Borders 1
680                            b
681                      bg1       │
682                  b1   │   b2   │   b3
683                   a   │    a   │    a
684                 │ ag1 │  │ ag1 │  │ ag1
685 d      c      a1│a2 a3│a1│a2 a3│a1│a2 a3
686 dg1 d1 c1      0│ 1  2│ 3│ 4  5│ 6│ 7  8
687       ╶─────────┼─────┼──┼─────┼──┼─────
688        cg1 c2  9│10 11│12│13 14│15│16 17
689            c3 18│19 20│21│22 23│24│25 26
690    ╶────────────┼─────┼──┼─────┼──┼─────
691     d2 c1     27│28 29│30│31 32│33│34 35
692       ╶─────────┼─────┼──┼─────┼──┼─────
693        cg1 c2 36│37 38│39│40 41│42│43 44
694            c3 45│46 47│48│49 50│51│52 53
695 ────────────────┼─────┼──┼─────┼──┼─────
696 d3     c1     54│55 56│57│58 59│60│61 62
697       ╶─────────┼─────┼──┼─────┼──┼─────
698        cg1 c2 63│64 65│66│67 68│69│70 71
699            c3 72│73 74│75│76 77│78│79 80
700
701 Category Borders 1
702                            b
703                      bg1       ┊
704                  b1   ┊   b2   ┊   b3
705                   a   ┊    a   ┊    a
706                 ┊ ag1 ┊  ┊ ag1 ┊  ┊ ag1
707 d      c      a1┊a2┊a3┊a1┊a2┊a3┊a1┊a2┊a3
708 dg1 d1 c1      0┊ 1┊ 2┊ 3┊ 4┊ 5┊ 6┊ 7┊ 8
709       ╶╌╌╌╌╌╌╌╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌
710        cg1 c2  9┊10┊11┊12┊13┊14┊15┊16┊17
711           ╶╌╌╌╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌
712            c3 18┊19┊20┊21┊22┊23┊24┊25┊26
713    ╶╌╌╌╌╌╌╌╌╌╌╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌
714     d2 c1     27┊28┊29┊30┊31┊32┊33┊34┊35
715       ╶╌╌╌╌╌╌╌╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌
716        cg1 c2 36┊37┊38┊39┊40┊41┊42┊43┊44
717           ╶╌╌╌╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌
718            c3 45┊46┊47┊48┊49┊50┊51┊52┊53
719 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌
720 d3     c1     54┊55┊56┊57┊58┊59┊60┊61┊62
721       ╶╌╌╌╌╌╌╌╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌
722        cg1 c2 63┊64┊65┊66┊67┊68┊69┊70┊71
723           ╶╌╌╌╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌+╌╌
724            c3 72┊73┊74┊75┊76┊77┊78┊79┊80
725
726 Category and Dimension Borders 1
727                            b
728                      bg1       │
729                  b1   │   b2   │   b3
730                   a   │    a   │    a
731                 │ ag1 │  │ ag1 │  │ ag1
732 d      c      a1│a2┊a3│a1│a2┊a3│a1│a2┊a3
733 dg1 d1 c1      0│ 1┊ 2│ 3│ 4┊ 5│ 6│ 7┊ 8
734       ╶─────────┼──┼──┼──┼──┼──┼──┼──┼──
735        cg1 c2  9│10┊11│12│13┊14│15│16┊17
736           ╶╌╌╌╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌
737            c3 18│19┊20│21│22┊23│24│25┊26
738    ╶────────────┼──┼──┼──┼──┼──┼──┼──┼──
739     d2 c1     27│28┊29│30│31┊32│33│34┊35
740       ╶─────────┼──┼──┼──┼──┼──┼──┼──┼──
741        cg1 c2 36│37┊38│39│40┊41│42│43┊44
742           ╶╌╌╌╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌
743            c3 45│46┊47│48│49┊50│51│52┊53
744 ────────────────┼──┼──┼──┼──┼──┼──┼──┼──
745 d3     c1     54│55┊56│57│58┊59│60│61┊62
746       ╶─────────┼──┼──┼──┼──┼──┼──┼──┼──
747        cg1 c2 63│64┊65│66│67┊68│69│70┊71
748           ╶╌╌╌╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌
749            c3 72│73┊74│75│76┊77│78│79┊80
750 ])
751 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
752 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
753 AT_CLEANUP
754
755 AT_SETUP([pivot table - category and dimension borders 2])
756 AT_DATA([pivot.txt], [[
757 /col "a"*("a1", "ag1"("a2", "a3"))
758 /col "b"*("bg1"("b1", "b2"), "b3")
759 /row "c"*("c1", "cg1"("c2", "c3"))
760 /row "d"*("dg1"("d1", "d2"), "d3")
761 /cell[all, all, all, all]
762 /border "*" (none)
763 /border "dim-row-vert" (solid "blue")
764 /border "dim-col-horz" (solid "blue")
765 /title "Dimension Borders 2"
766 /display
767 /border "*" (none)
768 /border "cat-row-vert" (dashed "red")
769 /border "cat-col-horz" (dashed "red")
770 /title "Category Borders 2"
771 /display
772 /border "*" (none)
773 /border "dim-row-vert" (solid "blue")
774 /border "cat-row-vert" (dashed "red")
775 /border "dim-col-horz" (solid "blue")
776 /border "cat-col-horz" (dashed "red")
777 /title "Category and Dimension Borders 2"
778 ]])
779 AT_DATA([expout], [dnl
780 Dimension Borders 2
781                            b
782                      bg1
783                  b1       b2       b3
784              ╶──────────────────────────
785                   a        a        a
786                   ag1      ag1      ag1
787 d      c      a1 a2 a3 a1 a2 a3 a1 a2 a3
788 dg1 d1│c1      0  1  2  3  4  5  6  7  8
789       │cg1 c2  9 10 11 12 13 14 15 16 17
790       │    c3 18 19 20 21 22 23 24 25 26
791     d2│c1     27 28 29 30 31 32 33 34 35
792       │cg1 c2 36 37 38 39 40 41 42 43 44
793       │    c3 45 46 47 48 49 50 51 52 53
794 d3    │c1     54 55 56 57 58 59 60 61 62
795       │cg1 c2 63 64 65 66 67 68 69 70 71
796       │    c3 72 73 74 75 76 77 78 79 80
797
798 Category Borders 2
799                            b
800              ╶╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
801                      bg1
802              ╶╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╴
803                  b1       b2       b3
804              ╶╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
805                   a        a        a
806              ╶╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
807                   ag1      ag1      ag1
808                 ╶╌╌╌╌╌╴  ╶╌╌╌╌╌╴  ╶╌╌╌╌╌
809 d      c      a1 a2 a3 a1 a2 a3 a1 a2 a3
810 dg1┊d1┊c1      0  1  2  3  4  5  6  7  8
811    ┊  ┊cg1┊c2  9 10 11 12 13 14 15 16 17
812    ┊  ┊   ┊c3 18 19 20 21 22 23 24 25 26
813    ┊d2┊c1     27 28 29 30 31 32 33 34 35
814    ┊  ┊cg1┊c2 36 37 38 39 40 41 42 43 44
815    ┊  ┊   ┊c3 45 46 47 48 49 50 51 52 53
816 d3    ┊c1     54 55 56 57 58 59 60 61 62
817       ┊cg1┊c2 63 64 65 66 67 68 69 70 71
818       ┊   ┊c3 72 73 74 75 76 77 78 79 80
819
820 Category and Dimension Borders 2
821                            b
822              ╶╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
823                      bg1
824              ╶╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╴
825                  b1       b2       b3
826              ╶──────────────────────────
827                   a        a        a
828              ╶╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
829                   ag1      ag1      ag1
830                 ╶╌╌╌╌╌╴  ╶╌╌╌╌╌╴  ╶╌╌╌╌╌
831 d      c      a1 a2 a3 a1 a2 a3 a1 a2 a3
832 dg1┊d1│c1      0  1  2  3  4  5  6  7  8
833    ┊  │cg1┊c2  9 10 11 12 13 14 15 16 17
834    ┊  │   ┊c3 18 19 20 21 22 23 24 25 26
835    ┊d2│c1     27 28 29 30 31 32 33 34 35
836    ┊  │cg1┊c2 36 37 38 39 40 41 42 43 44
837    ┊  │   ┊c3 45 46 47 48 49 50 51 52 53
838 d3    │c1     54 55 56 57 58 59 60 61 62
839       │cg1┊c2 63 64 65 66 67 68 69 70 71
840       │   ┊c3 72 73 74 75 76 77 78 79 80
841 ])
842 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
843 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
844 AT_CLEANUP
845
846 AT_SETUP([pivot table - category and dimension borders 3])
847 AT_DATA([pivot.txt], [[
848 /col "a"("a1", "ag1"("a2", "a3"))
849 /col "b"("bg1"("b1", "b2"), "b3")
850 /row "c"("c1", "cg1"("c2", "c3"))
851 /row "d"("dg1"("d1", "d2"), "d3")
852 /cell[all, all, all, all]
853 /border "*" (none)
854 /border "dim-row-horz" (solid "blue")
855         "cat-row-horz" (dashed "red")
856         "dim-row-vert" (solid "blue")
857         "cat-row-vert" (dashed "red")
858         "dim-col-horz" (solid "blue")
859         "cat-col-horz" (dashed "red")
860         "dim-col-vert" (solid "blue")
861         "cat-col-vert" (dashed "red")
862 /title "Category and Dimension Borders 3"
863 ]])
864 AT_DATA([expout], [dnl
865 Category and Dimension Borders 3
866                      bg1       │
867              ╶╌╌╌╌╌╌╌╌┬╌╌╌╌╌╌╌╌┤
868                  b1   │   b2   │   b3
869              ╶──┬─────┼──┬─────┼──┬─────
870                 │ ag1 │  │ ag1 │  │ ag1
871                 ├╌╌┬╌╌┤  ├╌╌┬╌╌┤  ├╌╌┬╌╌
872               a1│a2┊a3│a1│a2┊a3│a1│a2┊a3
873 dg1┊d1│c1      0│ 1┊ 2│ 3│ 4┊ 5│ 6│ 7┊ 8
874    ┊  ├───┬─────┼──┼──┼──┼──┼──┼──┼──┼──
875    ┊  │cg1┊c2  9│10┊11│12│13┊14│15│16┊17
876    ┊  │   ├╌╌╌╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌
877    ┊  │   ┊c3 18│19┊20│21│22┊23│24│25┊26
878    ├──┼───┴─────┼──┼──┼──┼──┼──┼──┼──┼──
879    ┊d2│c1     27│28┊29│30│31┊32│33│34┊35
880    ┊  ├───┬─────┼──┼──┼──┼──┼──┼──┼──┼──
881    ┊  │cg1┊c2 36│37┊38│39│40┊41│42│43┊44
882    ┊  │   ├╌╌╌╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌
883    ┊  │   ┊c3 45│46┊47│48│49┊50│51│52┊53
884 ───┴──┼───┴─────┼──┼──┼──┼──┼──┼──┼──┼──
885 d3    │c1     54│55┊56│57│58┊59│60│61┊62
886       ├───┬─────┼──┼──┼──┼──┼──┼──┼──┼──
887       │cg1┊c2 63│64┊65│66│67┊68│69│70┊71
888       │   ├╌╌╌╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌
889       │   ┊c3 72│73┊74│75│76┊77│78│79┊80
890 ])
891 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
892 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
893 AT_CLEANUP
894
895 AT_SETUP([pivot table - small numbers])
896 AT_DATA([pivot.txt], [[
897 /title "small numbers"
898 /row "exponent"*("0", "-1", "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9")
899 /col "sign"*("positive", "negative")
900 /col "result class"*("general" RC_OTHER, "specific" RC_RESIDUAL)
901 /cell[0, 0, 0] = 1
902 /cell[1, 0, 0] = .1
903 /cell[2, 0, 0] = .01
904 /cell[3, 0, 0] = .001
905 /cell[4, 0, 0] = .0001
906 /cell[5, 0, 0] = .00001
907 /cell[6, 0, 0] = .000001
908 /cell[7, 0, 0] = .0000001
909 /cell[8, 0, 0] = .00000001
910 /cell[9, 0, 0] = .000000001
911 /cell[0, 0, 1] = -1
912 /cell[1, 0, 1] = -.1
913 /cell[2, 0, 1] = -.01
914 /cell[3, 0, 1] = -.001
915 /cell[4, 0, 1] = -.0001
916 /cell[5, 0, 1] = -.00001
917 /cell[6, 0, 1] = -.000001
918 /cell[7, 0, 1] = -.0000001
919 /cell[8, 0, 1] = -.00000001
920 /cell[9, 0, 1] = -.000000001
921 /cell[0, 1, 0] = 1
922 /cell[1, 1, 0] = .1
923 /cell[2, 1, 0] = .01
924 /cell[3, 1, 0] = .001
925 /cell[4, 1, 0] = .0001
926 /cell[5, 1, 0] = .00001
927 /cell[6, 1, 0] = .000001
928 /cell[7, 1, 0] = .0000001
929 /cell[8, 1, 0] = .00000001
930 /cell[9, 1, 0] = .000000001
931 /cell[0, 1, 1] = -1
932 /cell[1, 1, 1] = -.1
933 /cell[2, 1, 1] = -.01
934 /cell[3, 1, 1] = -.001
935 /cell[4, 1, 1] = -.0001
936 /cell[5, 1, 1] = -.00001
937 /cell[6, 1, 1] = -.000001
938 /cell[7, 1, 1] = -.0000001
939 /cell[8, 1, 1] = -.00000001
940 /cell[9, 1, 1] = -.000000001
941 ]])
942 AT_DATA([expout], [dnl
943 small numbers
944 ╭────────┬─────────────────────────────────────╮
945 │        │             result class            │
946 │        ├───────────────────┬─────────────────┤
947 │        │      general      │     specific    │
948 │        ├───────────────────┼─────────────────┤
949 │        │        sign       │       sign      │
950 │        ├─────────┬─────────┼────────┬────────┤
951 │exponent│ positive│ negative│positive│negative│
952 ├────────┼─────────┼─────────┼────────┼────────┤
953 │0       │     1.00│     1.00│   -1.00│   -1.00│
954 │-1      │      .10│      .10│    -.10│    -.10│
955 │-2      │      .01│      .01│    -.01│    -.01│
956 │-3      │      .00│      .00│     .00│     .00│
957 │-4      │      .00│      .00│     .00│     .00│
958 │-5      │1.00E-005│1.00E-005│     .00│     .00│
959 │-6      │1.00E-006│1.00E-006│     .00│     .00│
960 │-7      │1.00E-007│1.00E-007│     .00│     .00│
961 │-8      │1.00E-008│1.00E-008│     .00│     .00│
962 │-9      │1.00E-009│1.00E-009│     .00│     .00│
963 ╰────────┴─────────┴─────────┴────────┴────────╯
964 ])
965 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [expout])
966 AT_CHECK([pspp-output -O box=unicode convert render.spv -], [0], [expout])
967 AT_CLEANUP