SYSFILE INFO: Improve output formatting by using nested tables.
[pspp] / tests / language / stats / rank.at
index 6cb366849b88da1e6c7664593ee3c2043cb0a93e..2b909b9e54ac5c5f87aac2dd173efa39c9f7ae94 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 *.
@@ -83,58 +117,34 @@ a into count(N of a)
 
 b into Nb(N of b)
 
-Variable,Description,,Position
-a,Format: F8.2,,1
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-b,Format: F8.2,,2
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-count,N of a,,3
-,Format: F6.0,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-Ra,RANK of a,,4
-,Format: F9.3,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-Rb,RANK of b,,5
-,Format: F9.3,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-RFR001,RFRACTION of a,,6
-,Format: F6.4,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-RFR002,RFRACTION of b,,7
-,Format: F6.4,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-Nb,N of b,,8
-,Format: F6.0,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
+Variable,Description,Position
+a,Format: F8.2,1
+b,Format: F8.2,2
+Ra,"Label: RANK of a
+Format: F9.3",3
+RFR001,"Label: RFRACTION of a
+Format: F6.4",4
+count,"Label: N of a
+Format: F6.0",5
+Rb,"Label: RANK of b
+Format: F9.3",6
+RFR002,"Label: RFRACTION of b
+Format: F6.4",7
+Nb,"Label: N of b
+Format: F6.0",8
 
 Table: Data List
-a,b,count,Ra,Rb,RFR001,RFR002,Nb
-.00,24.00,10,10.000,8.000,1.0000,.8889,9
-1.00,32.00,10,9.000,4.000,.9000,.4444,9
-2.00,31.00,10,8.000,5.000,.8000,.5556,9
-2.00,32.00,10,8.000,4.000,.8000,.4444,9
-4.00,30.00,10,6.000,6.000,.6000,.6667,9
-5.00,29.00,10,5.000,7.000,.5000,.7778,9
-6.00,1.00,10,4.000,9.000,.4000,1.0000,9
-7.00,43.00,10,3.000,2.000,.3000,.2222,9
-8.00,.  ,10,2.000,.   ,.2000,.    ,.
-9.00,45.00,10,1.000,1.000,.1000,.1111,9
+a,b,Ra,RFR001,count,Rb,RFR002,Nb
+.00,24.00,10.000,1.0000,10,8.000,.8889,9
+1.00,32.00,9.000,.9000,10,4.000,.4444,9
+2.00,31.00,8.000,.8000,10,5.000,.5556,9
+2.00,32.00,8.000,.8000,10,4.000,.4444,9
+4.00,30.00,6.000,.6000,10,6.000,.6667,9
+5.00,29.00,5.000,.5000,10,7.000,.7778,9
+6.00,1.00,4.000,.4000,10,9.000,1.0000,9
+7.00,43.00,3.000,.3000,10,2.000,.2222,9
+8.00,.  ,2.000,.2000,10,.   ,.    ,.
+9.00,45.00,1.000,.1000,10,1.000,.1111,9
 ])
 AT_CLEANUP
 
@@ -411,6 +421,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 *.
@@ -440,24 +506,12 @@ Variables Created By RANK
 
 foo into RAN001(RANK of foo)
 
-Variable,Description,,Position
-foo,Format: F8.2,,1
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-rfoo,Format: F8.2,,2
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-ran003,Format: F8.2,,3
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-RAN001,RANK of foo,,4
-,Format: F9.3,,
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
+Variable,Description,Position
+foo,Format: F8.2,1
+rfoo,Format: F8.2,2
+ran003,Format: F8.2,3
+RAN001,"Label: RANK of foo
+Format: F9.3",4
 ])
 AT_CLEANUP
 
@@ -481,19 +535,19 @@ DELETE VAR ran001 TO ran999.
 LIST.
 ])
 AT_CHECK([pspp -O format=csv rank.sps], [0], [dnl
-"rank.sps:3: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:3: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:4: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:4: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:5: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:5: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:6: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:6: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:7: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:7: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:8: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:8: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:9: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:9: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
 Variables Created By RANK