Fix import of ods files with repeated column data.
[pspp] / tests / data / spreadsheet-test.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2020, 2021 Free Software Foundation, Inc.
3 dnl
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 dnl
17 AT_BANNER([spreadsheet])
18
19 m4_define([SPREADSHEET_TEST],
20   [AT_SETUP([$1 $2])
21    AT_KEYWORDS([spreadsheet $4])
22    AT_CHECK([spreadsheet-test $2 $top_srcdir/tests/data/$1.gnumeric], [0], [$3], [ignore])
23    AT_CHECK([spreadsheet-test $2 $top_srcdir/tests/data/$1.ods], [0], [$3], [ignore])
24    AT_CLEANUP])
25
26 SPREADSHEET_TEST([simple], [--sheet=0], [dnl
27 Rows 4; Columns 3
28 one     two     three
29 four    five    six
30 seven   eight   nine
31 ten     eleven  twelve
32 ])
33
34 SPREADSHEET_TEST([simple], [--sheet=0 --reverse], [dnl
35 Rows 4; Columns 3
36 twelve  eleven  ten
37 nine    eight   seven
38 six     five    four
39 three   two     one
40 ])
41
42
43 SPREADSHEET_TEST([multisheet], [--sheet=1], [dnl
44 Rows 4; Columns 3
45 hi      tweedle 1
46 ho      dee     2
47 hum     dum     3
48 6       5       4
49 ])
50
51
52 SPREADSHEET_TEST([repeating], [], [dnl
53 Rows 3; Columns 5
54 one     one     one     two     two
55 two     three   three   three   four
56 four    four    five    five    five
57 ])
58
59 SPREADSHEET_TEST([sparse], [], [dnl
60 Rows 2; Columns 6
61                         0       1       2
62 the     row     above   starts  at      D
63 ])
64
65 SPREADSHEET_TEST([holey], [], [dnl
66 Rows 1; Columns 8
67                 hi      ho                      hum     hee
68 ])
69
70 dnl If this test takes an unreasonably long time, then probably the caching
71 dnl code is not working.
72 dnl On my machine, this test takes about 7 seconds
73 SPREADSHEET_TEST([one-thousand-by-fifty-three], [--refcheck --reverse], [dnl
74 Rows 1000; Columns 53
75 ], [slow])
76
77 dnl Check that the worksheet metadata is retrieved correctly
78 SPREADSHEET_TEST([multisheet], [--metadata], [dnl
79 Number of sheets: 3
80 ])
81
82 SPREADSHEET_TEST([simple], [--metadata], [dnl
83 Number of sheets: 1
84 ])
85
86
87
88 AT_SETUP([spreadsheet ODS with repeating data])
89 cp "$top_srcdir/tests/data/repeating-2.ods" .
90 AT_DATA([ods-import.sps], [dnl
91 get data /type=ods
92    /file="repeating-2.ods"
93    /sheet=index 1
94    /cellrange=range "a1:j8"
95    /readnames=on.
96
97 display variables.
98 list.
99 ])
100
101 dnl Test for bug #61078
102 AT_CHECK([pspp -O format=csv ods-import.sps], [0], [dnl
103 Table: Variables
104 Name,Position,Print Format,Write Format
105 s2,1,F8.2,F8.2
106 s3,2,F8.2,F8.2
107 s4,3,F8.2,F8.2
108 s5,4,F8.2,F8.2
109 s6,5,F8.2,F8.2
110 s7,6,F8.2,F8.2
111 s6_A,7,F8.2,F8.2
112 s7_A,8,F8.2,F8.2
113 s8,9,F8.2,F8.2
114 s9,10,F8.2,F8.2
115
116 Table: Data List
117 s2,s3,s4,s5,s6,s7,s6_A,s7_A,s8,s9
118 31.00,5.00,1.00,1.00,4.00,5.00,4.00,5.00,5.00,4.00
119 38.00,1.00,.00,2.00,5.00,5.00,4.00,4.00,5.00,4.00
120 24.00,1.00,.00,3.00,5.00,5.00,4.00,4.00,5.00,3.00
121 49.00,5.00,2.00,3.00,4.00,5.00,4.00,5.00,5.00,5.00
122 30.00,1.00,.00,2.00,5.00,5.00,5.00,5.00,5.00,5.00
123 33.00,5.00,2.00,2.00,5.00,5.00,5.00,5.00,5.00,5.00
124 32.00,1.00,23.00,2.00,4.00,5.00,3.00,4.00,4.00,3.00
125 ])
126
127 AT_CLEANUP