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