pivot-table: Change the default format to omit empty rows and columns.
[pspp] / tests / language / dictionary / formats.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 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([FORMATS])
18
19 AT_SETUP([FORMATS positive tests])
20 AT_DATA([formats.sps], [dnl
21 DATA LIST LIST /a b c * x (A1) y (A2) z (A3).
22 DISPLAY VARIABLES.
23 FORMATS /a (COMMA10) b (N4).
24 DISPLAY VARIABLES.
25 FORMATS c (E8.1) x (A1) /y (AHEX4) z (A3).
26 DISPLAY VARIABLES.
27 ])
28 AT_CHECK([pspp -o pspp.csv formats.sps])
29 AT_CHECK([grep -E -v 'Measure|Display' pspp.csv], [0], [dnl
30 Table: Reading free-form data from INLINE.
31 Variable,Format
32 a,F8.0
33 b,F8.0
34 c,F8.0
35 x,A1
36 y,A2
37 z,A3
38
39 Table: Variables
40 Name,Position,Print Format,Write Format
41 a,1,F8.2,F8.2
42 b,2,F8.2,F8.2
43 c,3,F8.2,F8.2
44 x,4,A1,A1
45 y,5,A2,A2
46 z,6,A3,A3
47
48 Table: Variables
49 Name,Position,Print Format,Write Format
50 a,1,COMMA10.0,COMMA10.0
51 b,2,N4.0,N4.0
52 c,3,F8.2,F8.2
53 x,4,A1,A1
54 y,5,A2,A2
55 z,6,A3,A3
56
57 Table: Variables
58 Name,Position,Print Format,Write Format
59 a,1,COMMA10.0,COMMA10.0
60 b,2,N4.0,N4.0
61 c,3,E8.1,E8.1
62 x,4,A1,A1
63 y,5,AHEX4,AHEX4
64 z,6,A3,A3
65 ])
66 AT_CLEANUP
67
68 AT_SETUP([FORMATS negative tests])
69 AT_DATA([formats.sps], [dnl
70 DATA LIST LIST /a b c * x (A1) y (A2) z (A3).
71 FORMATS a (E6.1).
72 FORMATS a y (F4).
73 FORMATS x (A2).
74 FORMATS y (AHEX2).
75 FORMATS x y (A2).
76 ])
77 AT_CHECK([pspp -O format=csv formats.sps], [1], [dnl
78 Table: Reading free-form data from INLINE.
79 Variable,Format
80 a,F8.0
81 b,F8.0
82 c,F8.0
83 x,A1
84 y,A2
85 z,A3
86
87 "formats.sps:2: error: FORMATS: Output format E6.1 specifies 1 decimal place, but the given width does not allow for any decimals."
88
89 formats.sps:3: error: FORMATS: a and y are not the same type.  All variables in this variable list must be of the same type.  y will be omitted from the list.
90
91 formats.sps:4: error: FORMATS: String variable with width 1 is not compatible with format A2.
92
93 formats.sps:5: error: FORMATS: String variable with width 2 is not compatible with format AHEX2.
94
95 formats.sps:6: error: FORMATS: x and y are string variables with different widths.  All variables in this variable list must have the same width.  y will be omitted from the list.
96
97 formats.sps:6: error: FORMATS: String variable with width 1 is not compatible with format A2.
98 ])
99 AT_CLEANUP