tests: Break get-data.at up into get-data-gnm.at and get-data-txt.at
[pspp-builds.git] / tests / language / data-io / get-data-gnm.at
1 AT_BANNER([GET DATA /TYPE=GNM])
2
3 AT_SETUP([GET DATA /TYPE=GNM with CELLRANGE])
4 AT_SKIP_IF([test "$GNM_SUPPORT" = no])
5 AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric])
6 AT_DATA([get-data.sps], [dnl
7 GET DATA /TYPE=gnm /FILE='Book1.gnumeric'  /READNAMES=off /SHEET=name 'This' /CELLRANGE=range 'g9:i13' .
8 DISPLAY VARIABLES.
9 LIST.
10 ])
11 AT_CHECK([pspp -o pspp.csv get-data.sps])
12 AT_CHECK([cat pspp.csv], [0], [dnl
13 Variable,Description,,Position
14 VAR001,Format: F8.2,,1
15 ,Measure: Scale,,
16 ,Display Alignment: Right,,
17 ,Display Width: 8,,
18 VAR002,Format: A8,,2
19 ,Measure: Nominal,,
20 ,Display Alignment: Left,,
21 ,Display Width: 8,,
22 VAR003,Format: F8.2,,3
23 ,Measure: Scale,,
24 ,Display Alignment: Right,,
25 ,Display Width: 8,,
26
27 Table: Data List
28 VAR001,VAR002,VAR003
29 .00,fred    ,20.00
30 1.00,11      ,21.00
31 2.00,twelve  ,22.00
32 3.00,13      ,23.00
33 4.00,14      ,24.00
34 ])
35 AT_CLEANUP
36
37 AT_SETUP([GET DATA /TYPE=GNM with CELLRANGE and READNAMES])
38 AT_SKIP_IF([test "$GNM_SUPPORT" = no])
39 AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric])
40 AT_DATA([get-data.sps], [dnl
41 GET DATA /TYPE=gnm /FILE='Book1.gnumeric'  /READNAMES=on /SHEET=name 'This' /CELLRANGE=range 'g8:i13' .
42 DISPLAY VARIABLES.
43 LIST.
44 ])
45 AT_CHECK([pspp -o pspp.csv get-data.sps])
46 AT_CHECK([cat pspp.csv], [0], [dnl
47 Variable,Description,,Position
48 V1,Format: F8.2,,1
49 ,Measure: Scale,,
50 ,Display Alignment: Right,,
51 ,Display Width: 8,,
52 V2,Format: A8,,2
53 ,Measure: Nominal,,
54 ,Display Alignment: Left,,
55 ,Display Width: 8,,
56 VAR001,Format: F8.2,,3
57 ,Measure: Scale,,
58 ,Display Alignment: Right,,
59 ,Display Width: 8,,
60
61 Table: Data List
62 V1,V2,VAR001
63 .00,fred    ,20.00
64 1.00,11      ,21.00
65 2.00,twelve  ,22.00
66 3.00,13      ,23.00
67 4.00,14      ,24.00
68 ])
69 AT_CLEANUP
70
71 AT_SETUP([GET DATA /TYPE=GNM without CELLRANGE])
72 AT_SKIP_IF([test "$GNM_SUPPORT" = no])
73 AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric])
74 AT_DATA([get-data.sps], [dnl
75 GET DATA /TYPE=gnm /FILE='Book1.gnumeric' /SHEET=index 3.
76 DISPLAY VARIABLES.
77 LIST.
78 ])
79 AT_CHECK([pspp -o pspp.csv get-data.sps])
80 AT_CHECK([cat pspp.csv], [0], [dnl
81 Variable,Description,,Position
82 name,Format: A8,,1
83 ,Measure: Nominal,,
84 ,Display Alignment: Left,,
85 ,Display Width: 8,,
86 id,Format: F8.2,,2
87 ,Measure: Scale,,
88 ,Display Alignment: Right,,
89 ,Display Width: 8,,
90 height,Format: F8.2,,3
91 ,Measure: Scale,,
92 ,Display Alignment: Right,,
93 ,Display Width: 8,,
94
95 Table: Data List
96 name,id,height
97 fred    ,.00,23.40
98 bert    ,1.00,.56
99 charlie ,2.00,.  @&t@
100 dick    ,3.00,-34.09
101 ])
102 AT_CLEANUP
103
104 AT_SETUP([GET DATA /TYPE=GNM with missing data])
105 AT_SKIP_IF([test "$GNM_SUPPORT" = no])
106 AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric])
107 AT_DATA([get-data.sps], [dnl
108 * This sheet has no data in one of its variables
109 GET DATA /TYPE=gnm /FILE='Book1.gnumeric' /READNAMES=on /SHEET=index 5.
110 DISPLAY VARIABLES.
111 LIST.
112 ])
113 AT_CHECK([pspp -o pspp.csv get-data.sps])
114 AT_CHECK([cat pspp.csv], [0], [dnl
115 Variable,Description,,Position
116 vone,Format: F8.2,,1
117 ,Measure: Scale,,
118 ,Display Alignment: Right,,
119 ,Display Width: 8,,
120 vtwo,Format: F8.2,,2
121 ,Measure: Scale,,
122 ,Display Alignment: Right,,
123 ,Display Width: 8,,
124 vthree,Format: A8,,3
125 ,Measure: Nominal,,
126 ,Display Alignment: Left,,
127 ,Display Width: 8,,
128 v4,Format: F8.2,,4
129 ,Measure: Scale,,
130 ,Display Alignment: Right,,
131 ,Display Width: 8,,
132
133 Table: Data List
134 vone,vtwo,vthree,v4
135 1.00,3.00,,5.00
136 2.00,4.00,,6.00
137 ])
138 AT_CLEANUP
139
140 AT_SETUP([GET DATA /TYPE=GNM with empty sheet])
141 AT_SKIP_IF([test "$GNM_SUPPORT" = no])
142 AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric])
143 AT_DATA([get-data.sps], [dnl
144 * This sheet is empty
145 GET DATA /TYPE=gnm /FILE='Book1.gnumeric' /SHEET=name 'Empty'.
146 ])
147 AT_CHECK([pspp -o pspp.csv get-data.sps], [0], [dnl
148 warning: Selected sheet or range of spreadsheet `Book1.gnumeric' is empty.
149 ])
150 AT_CLEANUP
151
152 AT_SETUP([GET DATA /TYPE=GNM with nonexistent sheet])
153 AT_SKIP_IF([test "$GNM_SUPPORT" = no])
154 AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric])
155 AT_DATA([get-data.sps], [dnl
156 * This sheet doesnt exist.
157 GET DATA /TYPE=gnm /FILE='Book1.gnumeric' /SHEET=name 'foobarxx'.
158 ])
159 AT_CHECK([pspp -o pspp.csv get-data.sps], [0], [dnl
160 warning: Selected sheet or range of spreadsheet `Book1.gnumeric' is empty.
161 ])
162 AT_CLEANUP