1 at_BANNER([GET DATA /TYPE=TXT])
3 dnl These tests exercise features of GET DATA /TYPE=TXT that
4 dnl it has in common with DATA LIST, using tests drawn from
7 AT_SETUP([GET DATA /TYPE=TXT with explicit delimiters])
8 AT_DATA([get-data.sps], [dnl
9 get data /type=txt /file=inline /delimiters="|X"
10 /variables=A f7.2 B f7.2 C f7.2 D f7.2.
19 AT_CHECK([pspp -o pspp.csv get-data.sps])
20 AT_CHECK([cat pspp.csv], [0], [dnl
24 2.00,22.00,34.00,23.00
25 3.00,34.00,34.00,34.00
29 AT_SETUP([GET DATA /TYPE=TXT with FIRSTCASE])
30 AT_DATA([get-data.sps], [dnl
31 get data /type=txt /file=inline /delimiters=', ' /delcase=variables 4
32 /firstcase=2 /variables=A f7.2 B f7.2 C f7.2 D f7.2.
34 # This record is ignored.
50 AT_CHECK([pspp -o pspp.csv get-data.sps])
51 AT_CHECK([cat pspp.csv], [0], [dnl
64 AT_SETUP([GET DATA /TYPE=TXT with FIRSTCASE and tab delimiter])
65 AT_DATA([get-data.sps], [dnl
66 get data /type=txt /file=inline /delimiters='\t' /delcase=variables 4
67 /firstcase=3 /variables=A f7.2 B f7.2 C f7.2 D f7.2.
90 AT_CHECK([pspp -o pspp.csv get-data.sps])
91 AT_CHECK([cat pspp.csv], [0], [dnl
113 AT_SETUP([GET DATA /TYPE=TXT with multiple records per case])
114 AT_DATA([get-data.sps], [dnl
115 get data /type=txt /file=inline /arrangement=fixed /fixcase=3 /variables=
132 AT_CHECK([pspp -o pspp.csv get-data.sps])
133 AT_CHECK([cat pspp.csv], [0], [dnl
136 07/22/2007,10/06/2007,321
137 07/14/1789,08/26/1789,4
138 01/01/1972,12/31/1999,682
142 AT_SETUP([GET DATA /TYPE=TXT with empty trailing record])
143 AT_DATA([get-data.sps], [dnl
144 get data /type=txt /file=inline /arrangement=fixed /fixcase=2 /variables=
161 AT_CHECK([pspp -o pspp.csv get-data.sps])
162 AT_CHECK([cat pspp.csv], [0], [dnl
173 dnl This test is a copy of an example given in the manual
174 dnl in doc/files.texi.
175 AT_SETUP([GET DATA /TYPE=TXT password example])
176 AT_DATA([passwd.data], [dnl
177 root:$1$nyeSP5gD$pDq/:0:0:,,,:/root:/bin/bash
178 blp:$1$BrP/pFg4$g7OG:1000:1000:Ben Pfaff,,,:/home/blp:/bin/bash
179 john:$1$JBuq/Fioq$g4A:1001:1001:John Darrington,,,:/home/john:/bin/bash
180 jhs:$1$D3li4hPL$88X1:1002:1002:Jason Stover,,,:/home/jhs:/bin/csh
182 AT_DATA([passwd.sps], [dnl
183 GET DATA /TYPE=TXT /FILE='passwd.data' /DELIMITERS=':'
184 /VARIABLES=username A20
193 AT_CHECK([pspp -o pspp.csv passwd.sps])
194 AT_CHECK([cat pspp.csv], [0], [dnl
196 username,password,uid,gid,gecos,home,shell
197 root ,$1$nyeSP5gD$pDq/ ,0,0,",,, ",/root ,/bin/bash @&t@
198 blp ,$1$BrP/pFg4$g7OG ,1000,1000,"Ben Pfaff,,, ",/home/blp ,/bin/bash @&t@
199 john ,$1$JBuq/Fioq$g4A ,1001,1001,"John Darrington,,, ",/home/john ,/bin/bash @&t@
200 jhs ,$1$D3li4hPL$88X1 ,1002,1002,"Jason Stover,,, ",/home/jhs ,/bin/csh @&t@
204 dnl This test is a copy of an example given in the manual
205 dnl in doc/files.texi.
206 AT_SETUP([GET DATA /TYPE=TXT cars example])
207 AT_DATA([cars.data], [dnl
208 model year mileage price type age
209 Civic 2002 29883 15900 Si 2
210 Civic 2003 13415 15900 EX 1
211 Civic 1992 107000 3800 n/a 12
212 Accord 2002 26613 17900 EX 1
214 AT_DATA([cars.sps], [dnl
215 GET DATA /TYPE=TXT /FILE='cars.data' /DELIMITERS=' ' /FIRSTCASE=2
224 GET DATA /TYPE=TXT /FILE='cars.data' /ARRANGEMENT=FIXED /FIRSTCASE=2
225 /VARIABLES=model 0-7 A
233 AT_CHECK([pspp -o pspp.csv cars.sps])
234 AT_CHECK([cat pspp.csv], [0], [dnl
236 model,year,mileage,price,type,age
237 Civic ,2002,29883,15900,Si ,2
238 Civic ,2003,13415,15900,EX ,1
239 Civic ,1992,107000,3800,n/a ,12
240 Accord ,2002,26613,17900,EX ,1
243 model,year,mileage,price,type,age
244 Civic ,2002,29883,15900,Si ,2
245 Civic ,2003,13415,15900,EX ,1
246 Civic ,1992,107000,3800,n/a ,12
247 Accord ,2002,26613,17900,EX ,1
251 dnl This test is a copy of an example given in the manual
252 dnl in doc/files.texi.
253 AT_SETUP([GET DATA /TYPE=TXT pets example])
254 AT_DATA([pets.data], [dnl
255 'Pet''s Name', "Age", "Color", "Date Received", "Price", "Height", "Type"
256 , (Years), , , (Dollars), ,
257 "Rover", 4.5, Brown, "12 Feb 2004", 80, '1''4"', "Dog"
258 "Charlie", , Gold, "5 Apr 2007", 12.3, "3""", "Fish"
259 "Molly", 2, Black, "12 Dec 2006", 25, '5"', "Cat"
260 "Gilly", , White, "10 Apr 2007", 10, "3""", "Guinea Pig"
262 AT_DATA([pets.sps], [dnl
263 GET DATA /TYPE=TXT /FILE='pets.data' /DELIMITERS=', ' /QUALIFIER='''"' /ESCAPE
274 AT_CHECK([pspp -o pspp.csv pets.sps])
275 AT_CHECK([cat pspp.csv], [0], [dnl
277 name,age,color,received,price,height,type
278 Rover ,4.5,Brown,12.02.2004,80.00,"1'4"" ",Dog @&t@
279 Charlie ,. ,Gold ,05.04.2007,12.30,"3"" ",Fish @&t@
280 Molly ,2.0,Black,12.12.2006,25.00,"5"" ",Cat @&t@
281 Gilly ,. ,White,10.04.2007,10.00,"3"" ",Guinea Pig
285 AT_SETUP([GET DATA /TYPE=TXT with IMPORTCASES])
286 AT_CHECK([$PERL > test.data <<'EOF'
287 for ($i = 1; $i <= 100; $i++) {
292 AT_DATA([get-data.sps], [dnl
293 get data /type=txt /file='test.data' /importcases=first 10 /variables x f8.0.
296 get data /type=txt /file='test.data' /importcases=percent 1 /variables x f8.0.
299 get data /type=txt /file='test.data' /importcases=percent 35 /variables x f8.0.
302 get data /type=txt /file='test.data' /importcases=percent 95 /variables x f8.0.
305 get data /type=txt /file='test.data' /importcases=percent 100 /variables x f8.0.
308 AT_CHECK([pspp -o pspp.csv get-data.sps])
309 AT_CHECK([cat pspp.csv], [0], [dnl