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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
dnl PSPP - a program for statistical analysis.
dnl Copyright (C) 2017 Free Software Foundation, Inc.
dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl
AT_BANNER([COMPUTE transformation])
AT_SETUP([COMPUTE crash with SAVE])
AT_DATA([compute.sps],
[INPUT PROGRAM.
COMPUTE num = 3.
END FILE.
END INPUT PROGRAM.
EXECUTE.
SAVE outfile='temp.sav'.
])
AT_CHECK([pspp -O format=csv compute.sps])
AT_DATA([list.sps],
[GET FILE='temp.sav'.
LIST.
])
AT_CHECK([pspp -O format=csv list.sps], [0],
[])
AT_CLEANUP
AT_SETUP([COMPUTE bug in long string UPCASE])
AT_DATA([compute.sps],
[DATA LIST LIST
/A (A161)
B (A3).
BEGIN DATA
abc def
ghi jkl
END DATA.
COMPUTE A=upcase(A).
EXECUTE.
LIST.
])
AT_CHECK([pspp -O format=csv compute.sps], [0],
[Table: Reading free-form data from INLINE.
Variable,Format
A,A161
B,A3
Table: Data List
A,B
ABC,def
GHI,jkl
])
AT_CLEANUP
AT_SETUP([COMPUTE bug with long variable names])
AT_DATA([compute.sps],
[DATA LIST LIST /longVariablename * x *.
BEGIN DATA.
1 2
3 4
END DATA.
COMPUTE longvariableName=100-longvariablename.
LIST.
])
AT_CHECK([pspp -O format=csv compute.sps], [0],
[Table: Reading free-form data from INLINE.
Variable,Format
longVariablename,F8.0
x,F8.0
Table: Data List
longVariablename,x
99.00,2.00
97.00,4.00
])
AT_CLEANUP
AT_SETUP([COMPUTE self-reference to new variable])
AT_DATA([compute.sps],
[DATA LIST /ITEM 1-3.
COMPUTE SUM=SUM+ITEM.
PRINT OUTFILE='compute-sum.out' /ITEM SUM.
LEAVE SUM
BEGIN DATA.
123
404
555
999
END DATA.
])
AT_CHECK([pspp -O format=csv compute.sps], [0],
[Table: Reading 1 record from INLINE.
Variable,Record,Columns,Format
ITEM,1,1-3,F3.0
])
AT_CHECK([cat compute-sum.out], [0],
[ 123 123.00 @&t@
404 527.00 @&t@
555 1082.00 @&t@
999 2081.00 @&t@
])
AT_CLEANUP
|