tests: Only check MODE=360 when EBCDIC is supported.
[pspp] / tests / language / data-io / add-files.at
1 m4_define([CHECK_ADD_FILES],
2   [AT_SETUP([ADD FILES -- $1 $2 with $3])
3    AT_DATA([a.data], [dnl
4 1aB
5 8aM
6 3aE
7 5aG
8 0aA
9 5aH
10 6aI
11 7aJ
12 2aD
13 7aK
14 1aC
15 7aL
16 4aF
17 ])
18    AT_DATA([b.data], [dnl
19 1bN
20 3bO
21 4bP
22 6bQ
23 7bR
24 9bS
25 ])
26    m4_if([$2], [sav],
27      [AT_DATA([save-a.sps], [dnl
28 DATA LIST NOTABLE FILE='a.data' /a b c 1-3 (A).
29 SAVE OUTFILE='a.sav'.
30 ])
31       AT_CHECK([pspp -O format=csv save-a.sps])])
32    m4_if([$3], [sav],
33      [AT_DATA([save-b.sps], [dnl
34 DATA LIST NOTABLE FILE='b.data' /a b c 1-3 (A).
35 SAVE OUTFILE='b.sav'.
36 ])
37       AT_CHECK([pspp -O format=csv save-b.sps])])
38    m4_if([$1], [interleave],
39           [m4_pushdef([BY], [[/BY a /FIRST=first /LAST=last]])
40            m4_pushdef([SORT], [[/SORT]])],
41           [m4_pushdef([BY], [])
42            m4_pushdef([SORT], [])])
43    AT_DATA([add-files.sps], [dnl
44 m4_if([$2], [sav], [], [DATA LIST NOTABLE FILE='a.data' /a b c 1-3 (A).])
45 m4_if([$3], [sav], [], [DATA LIST NOTABLE FILE='b.data' /a b c 1-3 (A).])
46 ADD FILES
47     m4_if([$2], [sav], [FILE='a.sav'], [FILE=*]) /IN=InA SORT
48     m4_if([$3], [sav], [FILE='b.sav'], [FILE=*]) /IN=InB /RENAME c=d
49     BY[].
50 LIST.
51 ])
52    m4_popdef([BY])
53    m4_popdef([SORT])
54    AT_CHECK([pspp -O format=csv add-files.sps], [0],
55 [m4_if([$1], [interleave], [dnl
56 Table: Data List
57 a,b,c,d,InA,InB,first,last
58 0,a,A,,1,0,1,1
59 1,a,B,,1,0,1,0
60 1,a,C,,1,0,0,0
61 1,b,,N,0,1,0,1
62 2,a,D,,1,0,1,1
63 3,a,E,,1,0,1,0
64 3,b,,O,0,1,0,1
65 4,a,F,,1,0,1,0
66 4,b,,P,0,1,0,1
67 5,a,G,,1,0,1,0
68 5,a,H,,1,0,0,1
69 6,a,I,,1,0,1,0
70 6,b,,Q,0,1,0,1
71 7,a,J,,1,0,1,0
72 7,a,K,,1,0,0,0
73 7,a,L,,1,0,0,0
74 7,b,,R,0,1,0,1
75 8,a,M,,1,0,1,1
76 9,b,,S,0,1,1,1
77 ], [dnl
78 Table: Data List
79 a,b,c,d,InA,InB
80 1,a,B,,1,0
81 8,a,M,,1,0
82 3,a,E,,1,0
83 5,a,G,,1,0
84 0,a,A,,1,0
85 5,a,H,,1,0
86 6,a,I,,1,0
87 7,a,J,,1,0
88 2,a,D,,1,0
89 7,a,K,,1,0
90 1,a,C,,1,0
91 7,a,L,,1,0
92 4,a,F,,1,0
93 1,b,,N,0,1
94 3,b,,O,0,1
95 4,b,,P,0,1
96 6,b,,Q,0,1
97 7,b,,R,0,1
98 9,b,,S,0,1
99 ])])
100 AT_CLEANUP
101 ])
102
103 AT_BANNER([ADD FILES])
104
105 CHECK_ADD_FILES([interleave], [sav], [sav])
106 CHECK_ADD_FILES([interleave], [sav], [inline])
107 CHECK_ADD_FILES([interleave], [inline], [sav])
108 CHECK_ADD_FILES([concatenate], [sav], [sav])
109 CHECK_ADD_FILES([concatenate], [sav], [inline])
110 CHECK_ADD_FILES([concatenate], [inline], [sav])