a2c005a93d57cb771adc240bd1501cc6991ac44b
[pspp] / tests / language / data-io / save.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 dnl
17 AT_BANNER([IMPORT and EXPORT])
18
19 AT_SETUP([IMPORT and EXPORT])
20 AT_DATA([import-export.sps], [dnl
21 DATA LIST LIST NOTABLE /X Y.
22 BEGIN DATA.
23 1 2
24 3 .
25 5 6
26 END DATA.
27
28 EXPORT /OUTFILE='wiz.por'.
29 IMPORT /FILE='wiz.por'.
30
31 LIST.
32 ])
33 AT_CHECK([pspp -o pspp.csv import-export.sps])
34 AT_CHECK([cat pspp.csv], [0], [dnl
35 Table: Data List
36 X,Y
37 1.00,2.00
38 3.00,.  @&t@
39 5.00,6.00
40 ])
41 AT_CLEANUP
42
43 AT_BANNER([SAVE])
44
45 # UNSELECTED=DELETE used to cause a crash if there was actually a
46 # filter variable.
47 AT_SETUP([SAVE -- delete unselected])
48 AT_DATA([data.txt], [dnl
49 0 '1 9:30:05' 1/2/2003 "25/8/1995 15:30:00" "'a,b,c'",0
50 , '-0 5:17' 10/31/2010 "9/4/2008 9:29:00" " xxx ",1
51 1.625,'0 12:00',,,xyzzy,1
52 ])
53 AT_DATA([save.pspp], [dnl
54 SET DECIMAL=DOT.
55 DATA LIST LIST NOTABLE FILE="data.txt"
56     /number(F8.3) time(DTIME10) date(ADATE10) datetime(DATETIME20) string(A8)
57      filter(F1.0).
58 MISSING VALUES number(0) time('0 12:00') string('xyzzy').
59 FILTER BY filter.
60 SAVE /OUTFILE="data.sav" /UNSELECTED=DELETE.
61 ])
62 AT_DATA([get.pspp], [dnl
63 GET FILE='data.sav'.
64 LIST.
65 ])
66 AT_CHECK([pspp -O format=csv save.pspp])
67 AT_CHECK([pspp -O format=csv get.pspp], [0], [dnl
68 Table: Data List
69 number,time,date,datetime,string,filter
70 .   ,-0 05:17,10/31/2010,09-APR-2008 09:29:00,xxx    ,1
71 1.625,0 12:00:00,.,.,xyzzy   ,1
72 ])
73 AT_CLEANUP