Add copyright and licence notices to files which lack them.
[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 AT_BANNER([FORMATS])
17
18 AT_SETUP([FORMATS positive tests])
19 AT_DATA([formats.sps], [dnl
20 DATA LIST LIST /a b c * x (A1) y (A2) z (A3).
21 DISPLAY VARIABLES.
22 FORMATS /a (COMMA10) b (N4).
23 DISPLAY VARIABLES.
24 FORMATS c (E8.1) x (A1) /y (AHEX4) z (A3).
25 DISPLAY VARIABLES.
26 ])
27 AT_CHECK([pspp -o pspp.csv formats.sps])
28 AT_CHECK([grep -E -v 'Measure|Display' pspp.csv], [0], [dnl
29 Table: Reading free-form data from INLINE.
30 Variable,Format
31 a,F8.0
32 b,F8.0
33 c,F8.0
34 x,A1
35 y,A2
36 z,A3
37
38 Variable,Description,Position
39 a,Format: F8.2,1
40 b,Format: F8.2,2
41 c,Format: F8.2,3
42 x,Format: A1,4
43 y,Format: A2,5
44 z,Format: A3,6
45
46 Variable,Description,Position
47 a,Format: COMMA10.0,1
48 b,Format: N4.0,2
49 c,Format: F8.2,3
50 x,Format: A1,4
51 y,Format: A2,5
52 z,Format: A3,6
53
54 Variable,Description,Position
55 a,Format: COMMA10.0,1
56 b,Format: N4.0,2
57 c,Format: E8.1,3
58 x,Format: A1,4
59 y,Format: AHEX4,5
60 z,Format: A3,6
61 ])
62 AT_CLEANUP
63
64 AT_SETUP([FORMATS negative tests])
65 AT_DATA([formats.sps], [dnl
66 DATA LIST LIST /a b c * x (A1) y (A2) z (A3).
67 FORMATS a (E6.1).
68 FORMATS a y (F4).
69 FORMATS x (A2).
70 FORMATS y (AHEX2).
71 FORMATS x y (A2).
72 ])
73 AT_CHECK([pspp -O format=csv formats.sps], [1], [dnl
74 Table: Reading free-form data from INLINE.
75 Variable,Format
76 a,F8.0
77 b,F8.0
78 c,F8.0
79 x,A1
80 y,A2
81 z,A3
82
83 "formats.sps:2: error: FORMATS: Output format E6.1 specifies 1 decimal place, but the given width does not allow for any decimals."
84
85 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.
86
87 formats.sps:4: error: FORMATS: String variable with width 1 is not compatible with format A2.
88
89 formats.sps:5: error: FORMATS: String variable with width 2 is not compatible with format AHEX2.
90
91 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.
92
93 formats.sps:6: error: FORMATS: String variable with width 1 is not compatible with format A2.
94 ])
95 AT_CLEANUP