Implemented the McNemar test. Closes bug #33242
[pspp-builds.git] / tests / language / xforms / compute.at
1 AT_BANNER([COMPUTE transformation])
2
3 AT_SETUP([COMPUTE crash with SAVE])
4 AT_DATA([compute.sps],
5   [INPUT PROGRAM.
6 COMPUTE num = 3.
7 END FILE.
8 END INPUT PROGRAM.
9 EXECUTE.
10
11 SAVE outfile='temp.sav'.
12 ])
13 AT_CHECK([pspp -O format=csv compute.sps])
14 AT_DATA([list.sps],
15   [GET FILE='temp.sav'.
16 LIST.
17 ])
18 AT_CHECK([pspp -O format=csv list.sps], [0], 
19   [])
20 AT_CLEANUP
21
22 AT_SETUP([COMPUTE bug in long string UPCASE])
23 AT_DATA([compute.sps],
24   [DATA LIST LIST
25  /A (A161)
26  B (A3).
27
28 BEGIN DATA
29 abc   def
30 ghi   jkl
31 END DATA.
32
33 COMPUTE A=upcase(A).
34 EXECUTE.
35 LIST.
36 ])
37 AT_CHECK([pspp -O format=csv compute.sps], [0],
38   [Table: Reading free-form data from INLINE.
39 Variable,Format
40 A,A161
41 B,A3
42
43 Table: Data List
44 A,B
45 ABC                                                                                                                                                              ,def
46 GHI                                                                                                                                                              ,jkl
47 ])
48 AT_CLEANUP
49
50 AT_SETUP([COMPUTE bug with long variable names])
51 AT_DATA([compute.sps],
52   [DATA LIST LIST /longVariablename * x *.
53 BEGIN DATA.
54 1 2
55 3 4
56 END DATA.
57
58
59 COMPUTE longvariableName=100-longvariablename.
60
61 LIST.
62 ])
63 AT_CHECK([pspp -O format=csv compute.sps], [0],
64   [Table: Reading free-form data from INLINE.
65 Variable,Format
66 longVariablename,F8.0
67 x,F8.0
68
69 Table: Data List
70 longVariablename,x
71 99.00,2.00
72 97.00,4.00
73 ])
74 AT_CLEANUP
75
76 AT_SETUP([COMPUTE self-reference to new variable])
77 AT_DATA([compute.sps],
78   [DATA LIST /ITEM 1-3.
79 COMPUTE SUM=SUM+ITEM.
80 PRINT OUTFILE='compute-sum.out' /ITEM SUM.
81 LEAVE SUM
82 BEGIN DATA.
83 123
84 404
85 555
86 999
87 END DATA.
88 ])
89 AT_CHECK([pspp -O format=csv compute.sps], [0],
90   [Table: Reading 1 record from INLINE.
91 Variable,Record,Columns,Format
92 ITEM,1,1-  3,F3.0
93 ])
94 AT_CHECK([cat compute-sum.out], [0],
95   [ 123   123.00 @&t@
96  404   527.00 @&t@
97  555  1082.00 @&t@
98  999  2081.00 @&t@
99 ])
100 AT_CLEANUP