a519b67fe3592583790a15e5ef6c929be2f2c5ff
[pspp-builds.git] / tests / language / data-io / get.at
1 AT_BANNER([GET])
2
3 dnl Tests for a bug which caused the second procedure
4 dnl after GET to have corrupt input.
5 AT_SETUP([GET data works in multiple procedures])
6 AT_DATA([get.sps], [dnl
7 DATA LIST LIST NOTABLE /LOCATION * EDITOR * SHELL * FREQ * .
8 BEGIN DATA.
9     1.00     1.00    1.0     2.00
10     1.00     1.00    2.0    30.00
11     1.00     2.00    1.0     8.00
12     1.00     2.00    2.0    20.00
13     2.00     1.00    1.0     2.00
14     2.00     1.00    2.0    22.00
15     2.00     2.00    1.0     1.00
16     2.00     2.00    2.0     3.00
17 END DATA.
18
19 SAVE /OUTFILE='foo.sav'.
20
21 GET /FILE='foo.sav'.
22
23 * This one's ok
24 LIST.
25
26 * But this one get rubbish
27 LIST.
28 ])
29 AT_CHECK([pspp -o pspp.csv get.sps])
30 AT_CHECK([cat pspp.csv], [0], [dnl
31 Table: Data List
32 LOCATION,EDITOR,SHELL,FREQ
33 1.00,1.00,1.00,2.00
34 1.00,1.00,2.00,30.00
35 1.00,2.00,1.00,8.00
36 1.00,2.00,2.00,20.00
37 2.00,1.00,1.00,2.00
38 2.00,1.00,2.00,22.00
39 2.00,2.00,1.00,1.00
40 2.00,2.00,2.00,3.00
41
42 Table: Data List
43 LOCATION,EDITOR,SHELL,FREQ
44 1.00,1.00,1.00,2.00
45 1.00,1.00,2.00,30.00
46 1.00,2.00,1.00,8.00
47 1.00,2.00,2.00,20.00
48 2.00,1.00,1.00,2.00
49 2.00,1.00,2.00,22.00
50 2.00,2.00,1.00,1.00
51 2.00,2.00,2.00,3.00
52 ])
53 AT_CLEANUP
54
55 dnl Tests for a bug that crashed when GET specified a nonexistent file.
56 AT_SETUP([GET nonexistent file doesn't crash])
57 dnl We use stdin here, because the bug seems to manifest itself only in 
58 dnl interactive mode.
59 AT_CHECK([echo "GET /FILE='nonexistent.sav'." | pspp -O format=csv], [1], [dnl
60 error: An error occurred while opening `nonexistent.sav': No such file or directory.
61
62 -:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
63 ])
64 AT_CLEANUP
65
66 dnl Tests for bug #15766 (/KEEP subcommand on SAVE doesn't
67 dnl fully support ALL) and underlying problems.
68 m4_define([GET_KEEP_ALL],
69   [AT_SETUP([GET with /KEEP=ALL crashes -- $1])
70    AT_DATA([get.sps], [dnl
71 DATA LIST LIST NOTABLE 
72         /a b c d e f g h i j k l m n o p q r s t u v w x y z (F2.0).
73 BEGIN DATA.
74 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
75 END DATA.
76 LIST.
77 SAVE OUTFILE='test.sav'/$1.
78 GET FILE='test.sav'/KEEP=x y z all.
79 LIST.
80 ])
81    AT_CHECK([pspp -o pspp.csv get.sps])
82    AT_CHECK([cat pspp.csv], [0], [dnl
83 Table: Data List
84 a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
85 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26
86
87 Table: Data List
88 x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w
89 24,25,26,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
90 ])
91    AT_CLEANUP])
92 GET_KEEP_ALL([uncompressed])
93 GET_KEEP_ALL([compressed])
94