1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
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.
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.
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/>.
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).
23 FORMATS /a (COMMA10) b (N4).
25 FORMATS c (E8.1) x (A1) /y (AHEX4) z (A3).
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.
40 Name,Position,Print Format,Write Format
49 Name,Position,Print Format,Write Format
50 a,1,COMMA10.0,COMMA10.0
58 Name,Position,Print Format,Write Format
59 a,1,COMMA10.0,COMMA10.0
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).
77 AT_CHECK([pspp -O format=csv formats.sps], [1], [dnl
78 Table: Reading free-form data from INLINE.
87 "formats.sps:2.12-2.15: error: FORMATS: Output format E6.1 specifies 1 decimal place, but width 6 does not allow for any decimals.
91 "formats.sps:3.11: 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.
95 "formats.sps:4.12-4.13: error: FORMATS: String variable x with width 1 is not compatible with format A2. Use format A1 instead.
99 "formats.sps:5.12-5.16: error: FORMATS: String variable y with width 2 is not compatible with format AHEX2. Use format AHEX4 instead.
100 5 | FORMATS y (AHEX2).
103 "formats.sps:6.11: 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.
104 6 | FORMATS x y (A2).
107 "formats.sps:6.14-6.15: error: FORMATS: String variable x with width 1 is not compatible with format A2. Use format A1 instead.
108 6 | FORMATS x y (A2).