5 4 6
7 5 8
7 6 9
-7 7 10
+7 7 20
9 8 11
end data.
aggregate outfile=* mode=addvariables
/break = x
/sum = sum(y)
- /mean = mean (y).
+ /mean = mean (y)
+ /median = median (y).
list.
])
AT_CHECK([pspp -O format=csv addvariables.sps], [0],
[Table: Data List
-x,cn,y,sum,mean
-1.00,1.00,2.00,2.00,2.00
-3.00,2.00,3.00,7.00,3.50
-3.00,3.00,4.00,7.00,3.50
-5.00,4.00,6.00,6.00,6.00
-7.00,5.00,8.00,27.00,9.00
-7.00,6.00,9.00,27.00,9.00
-7.00,7.00,10.00,27.00,9.00
-9.00,8.00,11.00,11.00,11.00
+x,cn,y,sum,mean,median
+1.00,1.00,2.00,2.00,2.00,2.00
+3.00,2.00,3.00,7.00,3.50,3.50
+3.00,3.00,4.00,7.00,3.50,3.50
+5.00,4.00,6.00,6.00,6.00,6.00
+7.00,5.00,8.00,37.00,12.33,9.00
+7.00,6.00,9.00,37.00,12.33,9.00
+7.00,7.00,20.00,37.00,12.33,9.00
+9.00,8.00,11.00,11.00,11.00,11.00
])
AT_CLEANUP
+
+
+AT_SETUP([AGGREGATE buggy duplicate variables])
+dnl Test for a bug which crashed when duplicated
+dnl variables were attempted.
+AT_DATA([dup-variables.sps],
+ [DATA LIST NOTABLE LIST /x * .
+begin data
+1
+1
+1
+1
+2
+2
+2
+3
+3
+3
+3
+3
+3
+end data.
+
+AGGREGATE OUTFILE=* MODE=ADDVARIABLES
+ /BREAK= x
+ /N_BREAK = N.
+
+AGGREGATE OUTFILE=* MODE=ADDVARIABLES
+ /BREAK= x
+ /N_BREAK = N.
+])
+
+AT_CHECK([pspp -O format=csv dup-variables.sps], [1],
+["dup-variables.sps:24: error: AGGREGATE: Variable name N_BREAK is not unique within the aggregate file dictionary, which contains the aggregate variables and the break variables."
+
+dup-variables.sps:24: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+])
+
+
+AT_CLEANUP
\ No newline at end of file