Add copyright and licence notices to files which lack them.
[pspp] / tests / language / data-io / inpt-pgm.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 AT_BANNER([INPUT PROGRAM])
17
18 dnl Tests for a bug which caused a crash when 
19 dnl reading invalid INPUT PROGRAM syntax.
20 AT_SETUP([INPUT PROGRAM invalid syntax crash])
21 AT_DATA([input-program.sps], [dnl
22 INPUT PROGRAM.
23 DATA LIST NOTABLE /a 1-9.
24 BEGIN DATA
25 123456789
26 END DATA.
27 END INPUT PROGRAM.
28 ])
29 AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
30 input-program.sps:3: error: BEGIN DATA: BEGIN DATA is not allowed inside INPUT PROGRAM.
31 ])
32 AT_CLEANUP
33
34 dnl Tests for bug #21108, a crash when 
35 dnl reading invalid INPUT PROGRAM syntax.
36 AT_SETUP([INPUT PROGRAM invalid syntax crash])
37 AT_DATA([input-program.sps], [dnl
38 INPUT PROGRAM.
39 DATA LIST LIST NOTABLE /x.
40 END FILE.
41 END INPUT PROGRAM.
42
43 DESCRIPTIVES x.
44 ])
45 AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
46 error: DESCRIPTIVES: Syntax error at end of input: expecting BEGIN.
47 ])
48 AT_CLEANUP
49
50 dnl Tests for bug #38782, an infinite loop processing an empty input program.
51 AT_SETUP([INPUT PROGRAM infinite loop])
52 AT_DATA([input-program.sps], [dnl
53 INPUT PROGRAM.
54 STRING firstname lastname (a24) / address (a80).
55 END INPUT PROGRAM.
56 EXECUTE.
57 ])
58 AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
59 input-program.sps:3: error: Input program must contain DATA LIST or END FILE.
60
61 input-program.sps:4: error: EXECUTE: EXECUTE is allowed only after the active dataset has been defined.
62 ])
63 AT_CLEANUP
64
65 dnl Tests for bug #39097, a bug when an INPUT PROGRAM used VECTOR, was
66 dnl followed immediately by a call to proc_execute() (here via DATASET
67 dnl COPY), and then the input was actually used.
68 AT_SETUP([INPUT PROGRAM with VECTOR and EXECUTE])
69 AT_DATA([input-program.sps], [dnl
70 INPUT PROGRAM.
71 VECTOR vec(5).
72 LOOP #c = 1 to 10.
73  LOOP #v = 1 to 5.
74   COMPUTE vec(#v) = #v.
75  END LOOP.
76  END CASE.
77 END LOOP.
78 END FILE.
79 END INPUT PROGRAM.
80 DATASET COPY x.
81 LIST.
82 ])
83 AT_CHECK([pspp -O format=csv input-program.sps], [0], [dnl
84 Table: Data List
85 vec1,vec2,vec3,vec4,vec5
86 1.00,2.00,3.00,4.00,5.00
87 1.00,2.00,3.00,4.00,5.00
88 1.00,2.00,3.00,4.00,5.00
89 1.00,2.00,3.00,4.00,5.00
90 1.00,2.00,3.00,4.00,5.00
91 1.00,2.00,3.00,4.00,5.00
92 1.00,2.00,3.00,4.00,5.00
93 1.00,2.00,3.00,4.00,5.00
94 1.00,2.00,3.00,4.00,5.00
95 1.00,2.00,3.00,4.00,5.00
96 ])
97 AT_CLEANUP