Automatically infer variables' measurement level from format and data.
[pspp] / tests / language / stats / rank.at
index 2194da5f861508256579e71f1e1198f812576326..bd3f8becb478495b37e66574fe2db0db7f2d10c7 100644 (file)
@@ -1,16 +1,16 @@
 dnl PSPP - a program for statistical analysis.
 dnl Copyright (C) 2017 Free Software Foundation, Inc.
-dnl 
+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
 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
 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
@@ -21,12 +21,12 @@ AT_DATA([rank.sps], [dnl
 DATA LIST LIST NOTABLE /x (f8).
 BEGIN DATA.
 -1
-0 
-1 
-2 
-2 
-4 
-5 
+0
+1
+2
+2
+4
+5
 END DATA.
 
 RANK x.
@@ -98,7 +98,7 @@ BEGIN DATA.
 END DATA.
 
 RANK a b (D)
-   /PRINT=YES 
+   /PRINT=YES
    /RANK
    /TIES=HIGH
    /RFRACTION
@@ -121,15 +121,15 @@ a,count,N
 b,Nb,N
 
 Table: Variables
-Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
-a,1,,Scale,Input,8,Right,F8.2,F8.2,
-b,2,,Scale,Input,8,Right,F8.2,F8.2,
-Ra,3,RANK of a,Scale,Input,8,Right,F9.3,F9.3,
-RFR001,4,RFRACTION of a,Scale,Input,8,Right,F6.4,F6.4,
-count,5,N of a,Scale,Input,8,Right,F6.0,F6.0,
-Rb,6,RANK of b,Scale,Input,8,Right,F9.3,F9.3,
-RFR002,7,RFRACTION of b,Scale,Input,8,Right,F6.4,F6.4,
-Nb,8,N of b,Scale,Input,8,Right,F6.0,F6.0,
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format
+a,1,,Nominal,Input,8,Right,F8.2,F8.2
+b,2,,Nominal,Input,8,Right,F8.2,F8.2
+Ra,3,RANK of a,Ordinal,Input,8,Right,F9.3,F9.3
+RFR001,4,RFRACTION of a,Ordinal,Input,8,Right,F6.4,F6.4
+count,5,N of a,Scale,Input,8,Right,F6.0,F6.0
+Rb,6,RANK of b,Ordinal,Input,8,Right,F9.3,F9.3
+RFR002,7,RFRACTION of b,Ordinal,Input,8,Right,F6.4,F6.4
+Nb,8,N of b,Scale,Input,8,Right,F6.0,F6.0
 
 Table: Data List
 a,b,Ra,RFR001,count,Rb,RFR002,Nb
@@ -158,7 +158,7 @@ BEGIN DATA.
 5 29
 6 1
 7 43
-8 8 
+8 8
 9 45
 END DATA.
 
@@ -283,7 +283,7 @@ a,g1,g2,Ra,Na,RAN001,NOR001
 AT_CLEANUP
 
 # Also tests small ranks for special case of SAVAGE ranks.
-AT_SETUP([RANK with fractional ranks]) 
+AT_SETUP([RANK with fractional ranks])
 AT_DATA([rank.sps], [dnl
 DATA LIST LIST NOTABLE  /a *  w * .
 BEGIN DATA.
@@ -299,7 +299,7 @@ END DATA.
 
 WEIGHT BY w.
 
-RANK a 
+RANK a
   /FRACTION=TUKEY
   /PROPORTION
   /SAVAGE
@@ -476,11 +476,11 @@ Existing Variable,New Variable,Function
 foo,RAN001,RANK
 
 Table: Variables
-Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
-foo,1,,Scale,Input,8,Right,F8.2,F8.2,
-rfoo,2,,Scale,Input,8,Right,F8.2,F8.2,
-ran003,3,,Scale,Input,8,Right,F8.2,F8.2,
-RAN001,4,RANK of foo,Scale,Input,8,Right,F9.3,F9.3,
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format
+foo,1,,Nominal,Input,8,Right,F8.2,F8.2
+rfoo,2,,Nominal,Input,8,Right,F8.2,F8.2
+ran003,3,,Nominal,Input,8,Right,F8.2,F8.2
+RAN001,4,RANK of foo,Ordinal,Input,8,Right,F9.3,F9.3
 ])
 AT_CLEANUP
 
@@ -575,29 +575,29 @@ BEGIN DATA.
 END DATA.
 
 * invalid NTILES (no parameter)
-RANK x 
+RANK x
   /NTILES
 .
 
 * invalid NTILES (not an integer)
-RANK x 
+RANK x
   /NTILES(d)
 .
 
 
 * destination variable already exists
-RANK x 
+RANK x
  /RANK INTO x.
 
 
 * Too many variables in INTO
-RANK x 
+RANK x
  /RANK INTO foo  bar wiz.
 ])
 AT_CHECK([pspp -O format=csv rank.sps], [1], [dnl
 rank.sps:15.1: error: RANK: Syntax error at end of command: expecting `@{:@'.
 
-rank.sps:19.11: error: RANK: Syntax error at `d': expecting integer.
+rank.sps:19.11: error: RANK: Syntax error at `d': Expected positive integer for NTILES.
 
 rank.sps:25: error: RANK: Variable x already exists.