Rework the spreadsheet import feature of the grapic user interface
[pspp] / tests / data / spreadsheet-test.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2020 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
71 dnl If this test takes an unreasonably long time, then probably the caching
72 dnl code is not working.
73 dnl On my machine, this test takes about 7 seconds
74 SPREADSHEET_TEST([one-thousand-by-fifty-three], [--refcheck --reverse], [dnl
75 Rows 1000; Columns 53
76 ], [slow])
77
78 dnl Check that the worksheet metadata is retrieved correctly
79 SPREADSHEET_TEST([multisheet], [--metadata], [dnl
80 Number of sheets: 3
81 ])
82
83 SPREADSHEET_TEST([simple], [--metadata], [dnl
84 Number of sheets: 1
85 ])