DISPLAY DICTIONARY: Add "Label: " prefix for variable labels in output.
[pspp] / tests / language / stats / rank.at
index 61c41805f7898b8bf96cac8708616254b2930147..d29e2e8df6124fc86e4b5d66352423557073fe39 100644 (file)
@@ -37,6 +37,40 @@ x,Rx
 ])
 AT_CLEANUP
 
+# This checks for regression against a crash reported as bug #38482
+# that occurred when multiple variables were specified without any
+# rank specifications.
+AT_SETUP([RANK multiple variables with defaults])
+AT_DATA([rank.sps], [dnl
+DATA LIST LIST NOTABLE /x * y * z *.
+BEGIN DATA.
+    1.00     2.00     3.00
+    4.00     5.00     6.00
+END DATA.
+
+RANK ALL.
+
+LIST.
+])
+AT_CHECK([pspp -o pspp.csv rank.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Variables Created By RANK
+
+
+
+x into Rx(RANK of x)
+
+y into Ry(RANK of y)
+
+z into Rz(RANK of z)
+
+Table: Data List
+x,y,z,Rx,Ry,Rz
+1.00,2.00,3.00,1.000,1.000,1.000
+4.00,5.00,6.00,2.000,2.000,2.000
+])
+AT_CLEANUP
+
 AT_SETUP([RANK with RANK, RFRACTION, N])
 AT_DATA([rank.sps], [dnl
 DATA LIST LIST NOTABLE /a * b *.
@@ -92,32 +126,32 @@ b,Format: F8.2,,2
 ,Measure: Scale,,
 ,Display Alignment: Right,,
 ,Display Width: 8,,
-Ra,RANK of a,,3
+Ra,Label: RANK of a,,3
 ,Format: F9.3,,
 ,Measure: Scale,,
 ,Display Alignment: Right,,
 ,Display Width: 8,,
-RFR001,RFRACTION of a,,4
+RFR001,Label: RFRACTION of a,,4
 ,Format: F6.4,,
 ,Measure: Scale,,
 ,Display Alignment: Right,,
 ,Display Width: 8,,
-count,N of a,,5
+count,Label: N of a,,5
 ,Format: F6.0,,
 ,Measure: Scale,,
 ,Display Alignment: Right,,
 ,Display Width: 8,,
-Rb,RANK of b,,6
+Rb,Label: RANK of b,,6
 ,Format: F9.3,,
 ,Measure: Scale,,
 ,Display Alignment: Right,,
 ,Display Width: 8,,
-RFR002,RFRACTION of b,,7
+RFR002,Label: RFRACTION of b,,7
 ,Format: F6.4,,
 ,Measure: Scale,,
 ,Display Alignment: Right,,
 ,Display Width: 8,,
-Nb,N of b,,8
+Nb,Label: N of b,,8
 ,Format: F6.0,,
 ,Measure: Scale,,
 ,Display Alignment: Right,,
@@ -411,6 +445,62 @@ x,w,xl,xh,xc,Nx
 ])
 AT_CLEANUP
 
+AT_SETUP([RANK and TEMPORARY])
+AT_DATA([rank.sps], [dnl
+DATA LIST LIST NOTABLE /age (f2) gender (a1).
+BEGIN DATA.
+44 m
+32 f
+43 m
+49 m
+33 f
+35 f
+29 f
+50 m
+42 m
+33 f
+48 m
+END DATA.
+
+TEMPORARY.
+SELECT IF gender = 'm'.
+RANK age /RANK INTO Rm.
+
+TEMPORARY.
+SELECT IF gender = 'f'.
+RANK age /RANK INTO Rf.
+
+LIST.
+])
+AT_CHECK([pspp -O format=csv rank.sps], [0], [dnl
+Variables Created By RANK
+
+
+
+age into Rm(RANK of age)
+
+Variables Created By RANK
+
+
+
+age into Rf(RANK of age)
+
+Table: Data List
+age,gender,Rm,Rf
+44,m,3.000,.   @&t@
+32,f,.   ,2.000
+43,m,2.000,.   @&t@
+49,m,5.000,.   @&t@
+33,f,.   ,3.500
+35,f,.   ,5.000
+29,f,.   ,1.000
+50,m,6.000,.   @&t@
+42,m,1.000,.   @&t@
+33,f,.   ,3.500
+48,m,4.000,.   @&t@
+])
+AT_CLEANUP
+
 AT_SETUP([RANK variable name fallback])
 AT_DATA([rank.sps], [dnl
 DATA LIST LIST NOTABLE /foo * rfoo * ran003 *.
@@ -453,7 +543,7 @@ ran003,Format: F8.2,,3
 ,Measure: Scale,,
 ,Display Alignment: Right,,
 ,Display Width: 8,,
-RAN001,RANK of foo,,4
+RAN001,Label: RANK of foo,,4
 ,Format: F9.3,,
 ,Measure: Scale,,
 ,Display Alignment: Right,,