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