tests: remove usage of old-style getters and setters
authorJean Privat <jean@pryen.org>
Tue, 15 Apr 2014 13:22:19 +0000 (09:22 -0400)
committerJean Privat <jean@pryen.org>
Tue, 15 Apr 2014 18:32:32 +0000 (14:32 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

27 files changed:
tests/base_attr_def.nit
tests/base_attr_init_val1.nit
tests/base_attr_init_val3.nit
tests/base_eq.nit
tests/base_init_auto.nit
tests/base_orelse.nit
tests/base_virtual_type.nit
tests/base_virtual_type2.nit
tests/base_virtual_type3.nit
tests/base_virtual_type6.nit
tests/base_virtual_type7.nit
tests/bench_netsim.nit
tests/bench_random_n_sort.nit
tests/bench_send.nit
tests/error_init_auto.nit
tests/error_type_not_ok4.nit
tests/example_time.nit
tests/rterror_null_receiver.nit
tests/sav/error_type_not_ok4.res
tests/sav/error_type_not_ok4_alt1.res
tests/sav/fixme/test_gen_inh.res [deleted file]
tests/sav/nitmetrics_args1.res
tests/sav/nitx_args3.res
tests/sav/test_combined_assignment_alt1.res
tests/test_boxing.nit
tests/test_combined_assignment.nit
tests/test_gen_inh.nit

index 1b7474d..17da0d3 100644 (file)
@@ -24,8 +24,8 @@ class Int
 end
 
 class Foo
-       readable writable var _a1: Int 
-       readable writable var _a2: Int
+       var a1: Int
+       var a2: Int
        fun run
        do
                a1.output
@@ -41,7 +41,7 @@ end
 
 class Bar
        super Foo
-       readable writable var _a3: Int 
+       var a3: Int
        redef fun run
        do
                a1.output
index 7c42007..c2082eb 100644 (file)
 import kernel
 
 class A
-       readable var _i: Int = 1
+       var i: Int = 1
        init do end
 end
 
 class B
-       readable var _a: A = new A
+       var a: A = new A
        init do end
 end
 
index a01ae58..78f9437 100644 (file)
 import kernel
 
 class A
-       readable var _i: Int = foo
+       var i: Int = foo
        fun foo: Int do return 1
        init do end
 end
 
 class B
-       readable var _a: A = bar
+       var a: A = bar
        fun bar: A do return new A
        init do end
 end
index f057695..13f0ec7 100644 (file)
 import kernel
 
 class A
-       readable var _a: Int 
-       
+       var a: Int
+
        init(a: Int)
        do
-               _a = a
+               a = a
        end
 end
 
 class B
        super A
-       redef fun ==(a: nullable Object): Bool
+       redef fun ==(o: nullable Object): Bool
        do
-               if not a isa B then
+               if not o isa B then
                        return false
                end
 
-               return a.a.is_same_instance(_a)
+               return o.a.is_same_instance(a)
        end
 
        init(b: Int)
        do
-               _a = b
+               a = b
        end
 end
 
index 933a230..963dc12 100644 (file)
 import kernel
 
 class A
-       readable var _x: Int #alt1#
-       #alt1#readable var _x: Int = 2
-       readable var _y: Int = -2 #alt2#
-       #alt2#readable var _y: Int
-       #alt3#init (xx: Int) do _x = xx
-       #alt4#init foo(xx: Int) do _x = xx
+       var x: Int #alt1#
+       #alt1#var x: Int = 2
+       var y: Int = -2 #alt2#
+       #alt2#var y: Int
+       #alt3#init (xx: Int) do x = xx
+       #alt4#init foo(xx: Int) do x = xx
        fun work
        do
-               _x.output
-               _y.output
+               x.output
+               y.output
        end
 end
 
index c02495c..2124b55 100644 (file)
@@ -15,7 +15,7 @@
 import kernel
 
 class A
-       readable writable var _i: Int
+       var i: Int
 end
 
 var a: nullable A = new A(1)
index db6a045..2f2a73f 100644 (file)
@@ -18,8 +18,8 @@ import kernel
 
 class A
        type E: T
-       
-       readable writable var _e: nullable E = null 
+
+       var e: nullable E writable = null
 end
 
 class B
index edc99cc..af6da5c 100644 (file)
@@ -19,7 +19,7 @@ import kernel
 class A
        type E: T
        
-       readable writable var _e: nullable E = null
+       var e: nullable E writable = null
 end
 
 class B
index 929d84a..6f66799 100644 (file)
@@ -19,7 +19,7 @@ import base_virtual_type2
 
 class C
        super A
-       readable writable var _tab: nullable Array[E]
+       var tab: nullable Array[E] writable
        init do end
 end
 
index 457f873..4d5ce65 100644 (file)
@@ -20,15 +20,15 @@ class G[E]
        type F: E
        type F2: F
 
-       readable writable var _e: E
-       readable writable var _f: F
-       readable writable var _f2: F2
+       var e: E writable
+       var f: F writable
+       var f2: F2 writable
 
        init(e: E, f: F, f2: F2)
        do
-               _e = e
-               _f = f
-               _f2 = f2
+               self.e = e
+               self.f = f
+               self.f2 = f2
        end
 end
 
index bde4a77..b4a79d0 100644 (file)
@@ -19,7 +19,7 @@ import kernel
 class A
        type E: F
        type F: E
-       readable writable var _e: nullable E = null
+       var e: nullable E writable = null
        init do end
 end
 
index f14a17b..ca5debe 100644 (file)
@@ -152,10 +152,10 @@ end
 
 class CountSink
        super NodeSink
-       readable var _count: Int = 0
+       var count: Int = 0
        redef fun recieve(n: NodeSource)
        do
-               _count = _count + 1
+               count = count + 1
        end
 end
 
@@ -192,12 +192,12 @@ class NodeEat
        var _limit: Int
        redef fun recieve(n: NodeSource)
        do
-               var c = _count + 1
+               var c = count + 1
                if c >= _limit then
-                       _count = 0
+                       count = 0
                        send
                else
-                       _count = c
+                       count = c
                end
        end
 
index d1689f6..513e78e 100644 (file)
@@ -32,11 +32,11 @@ redef class Int
 end
 
 class Integer
-       readable writable var _value: Int 
+       var value: Int
 
        init
        do
-               _value = 42
+               value = 42
        end
 end
 
index dcf2d9b..03218dc 100644 (file)
@@ -16,7 +16,7 @@
 
 
 class A
-       readable writable var _val: Int = 0
+       var val: Int = 0
        fun hop(a: A, b: A, c: A)
        do
                if a.val > val then
index 67eff9b..4e39ca8 100644 (file)
 import kernel
 
 class A
-       readable var _x: Int #alt1#
-       #alt1#readable var _x: Int = 2
-       readable var _y: Int = -2 #alt2#
-       #alt2#readable var _y: Int
-       #alt3#init (xx: Int) do _x = xx
-       #alt4#init foo(xx: Int) do _x = xx
+       var x: Int #alt1#
+       #alt1#var x: Int = 2
+       var y: Int = -2 #alt2#
+       #alt2#var y: Int
+       #alt3#init (xx: Int) do x = xx
+       #alt4#init foo(xx: Int) do x = xx
        fun work
        do
-               _x.output
-               _y.output
+               x.output
+               y.output
        end
 end
 
index 4762921..2862a61 100644 (file)
@@ -26,7 +26,7 @@ class F
 end
 
 class G
-       readable writable var _a: Fail
+       var a: Fail
        fun ma(a: Fail) do return
        fun mb(a: Array[Fail]) do return
        fun mc: Fail do return 0
index 0455879..b7af43e 100644 (file)
 # The Time class represents a quantity of time
 class Time
        # Internally, the quantity of time is stored in minutes
-       readable writable var _min: Int = 0
+       var min: Int = 0
 
        # The quantity ot time (in hours)
        fun hour: Int
        do
                # Need to transform minutes in hours
-               return _min / 60
+               return min / 60
        end
 
        # Set the quantity of time (in hour)
        fun hour=(i: Int)
        do
                # Need to transform hours in minutes
-               _min = i * 60
+               min = i * 60
        end
 
        # The quantity of tyme in human readable form (h:m)
index 481973b..c38c385 100644 (file)
@@ -15,9 +15,9 @@
 # limitations under the License.
 
 import kernel
-
 class A
-       readable writable var _foo: Int = 1
+       var foo: Int = 1
+       var _foo: Int = 2
 end
 
 var a: nullable A = null
index a691dd0..0a3a56d 100644 (file)
@@ -1,6 +1,6 @@
 error_type_not_ok4.nit:21,10--13: Type error: class Fail not found in module error_type_not_ok4.
 error_type_not_ok4.nit:25,16--19: Type error: class Fail not found in module error_type_not_ok4.
-error_type_not_ok4.nit:29,28--31: Type error: class Fail not found in module error_type_not_ok4.
+error_type_not_ok4.nit:29,9--12: Type error: class Fail not found in module error_type_not_ok4.
 error_type_not_ok4.nit:30,12--15: Type error: class Fail not found in module error_type_not_ok4.
 error_type_not_ok4.nit:31,18--21: Type error: class Fail not found in module error_type_not_ok4.
 error_type_not_ok4.nit:32,10--13: Type error: class Fail not found in module error_type_not_ok4.
index 96912f0..0882871 100644 (file)
@@ -1,6 +1,6 @@
 alt/error_type_not_ok4_alt1.nit:21,10--13: Type error: 'Fail' is a generic class.
 alt/error_type_not_ok4_alt1.nit:25,16--19: Type error: 'Fail' is a generic class.
-alt/error_type_not_ok4_alt1.nit:29,28--31: Type error: 'Fail' is a generic class.
+alt/error_type_not_ok4_alt1.nit:29,9--12: Type error: 'Fail' is a generic class.
 alt/error_type_not_ok4_alt1.nit:30,12--15: Type error: 'Fail' is a generic class.
 alt/error_type_not_ok4_alt1.nit:31,18--21: Type error: 'Fail' is a generic class.
 alt/error_type_not_ok4_alt1.nit:32,10--13: Type error: 'Fail' is a generic class.
diff --git a/tests/sav/fixme/test_gen_inh.res b/tests/sav/fixme/test_gen_inh.res
deleted file mode 100644 (file)
index b73b3fc..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-test_gen_inh.nit:36,48: Redef Error: Wrong static type. found Gen3#0, expected Gen1#0.
-test_gen_inh.nit:37,19--22: Redef Error: Wrong static type. found Char, expected Gen1#1.
index 4bb419d..4a951ac 100644 (file)
@@ -35,9 +35,9 @@
          min: base_simple3 (7)
          std: 0.0
        mnbr: number of refinement in module
-         avg: 1.0
-         max: base_simple3 (1)
-         min: base_simple3 (1)
+         avg: 3.0
+         max: base_simple3 (3)
+         min: base_simple3 (3)
          std: 0.0
        mnbcc: number of concrete class in module (intro + redef)
          avg: 4.0
@@ -50,9 +50,9 @@
          min: base_simple3 (0)
          std: 0.0
        mnbic: number of interface in module (intro + redef)
-         avg: 2.0
-         max: base_simple3 (2)
-         min: base_simple3 (2)
+         avg: 4.0
+         max: base_simple3 (4)
+         min: base_simple3 (4)
          std: 0.0
 
  ## project base_empty_module
          min: base_empty_module (1)
          std: 3.0
        mnbr: number of refinement in module
-         avg: 0.0
-         max: base_simple3 (1)
+         avg: 1.0
+         max: base_simple3 (3)
          min: base_empty_module (0)
-         std: 0.707
+         std: 1.581
        mnbcc: number of concrete class in module (intro + redef)
          avg: 2.0
          max: base_simple3 (4)
          min: base_simple3 (0)
          std: 0.0
        mnbic: number of interface in module (intro + redef)
-         avg: 1.0
-         max: base_simple3 (2)
+         avg: 2.0
+         max: base_simple3 (4)
          min: base_empty_module (0)
-         std: 1.0
+         std: 2.0
 
  ## global metrics
        mnoa: number of ancestor modules
          min: base_empty_module (1)
          std: 5.0
        mnbr: number of refinement in module
-         avg: 1.0
-         max: base_simple3 (1)
+         avg: 3.0
+         max: base_simple3 (3)
          min: base_empty_module (0)
-         std: 0.707
+         std: 2.121
        mnbcc: number of concrete class in module (intro + redef)
          avg: 5.0
          max: base_simple3 (4)
          min: base_simple3 (0)
          std: 0.0
        mnbic: number of interface in module (intro + redef)
-         avg: 2.0
-         max: base_simple3 (2)
+         avg: 4.0
+         max: base_simple3 (4)
          min: base_empty_module (0)
-         std: 1.414
+         std: 2.828
 
 # MClasses metrics
 
@@ -331,47 +331,48 @@ Distribution of direct smallers
   <=0: sub-population=1 (33.33%); cumulated value=0 (0.0%)
   <=1: sub-population=2 (66.66%); cumulated value=2 (100.00%)
 ## Classdef hierarchy
-Number of nodes: 9
-Number of edges: 23 (2.55 per node)
-Number of direct edges: 7 (0.77 per node)
+Number of nodes: 11
+Number of edges: 47 (4.27 per node)
+Number of direct edges: 9 (0.81 per node)
 Distribution of greaters
- population: 9
+ population: 11
  minimum value: 1
- maximum value: 3
- total value: 23
- average value: 2.55
+ maximum value: 5
+ total value: 47
+ average value: 4.27
  distribution:
-  <=1: sub-population=1 (11.11%); cumulated value=1 (4.34%)
-  <=2: sub-population=2 (22.22%); cumulated value=4 (17.39%)
-  <=4: sub-population=6 (66.66%); cumulated value=18 (78.26%)
+  <=1: sub-population=1 (9.09%); cumulated value=1 (2.12%)
+  <=4: sub-population=4 (36.36%); cumulated value=16 (34.04%)
+  <=8: sub-population=6 (54.54%); cumulated value=30 (63.82%)
 Distribution of direct greaters
- population: 9
+ population: 11
  minimum value: 0
- maximum value: 1
- total value: 7
- average value: 0.77
+ maximum value: 3
+ total value: 9
+ average value: 0.81
  distribution:
-  <=0: sub-population=2 (22.22%); cumulated value=0 (0.0%)
-  <=1: sub-population=7 (77.77%); cumulated value=7 (100.00%)
+  <=0: sub-population=4 (36.36%); cumulated value=0 (0.0%)
+  <=1: sub-population=6 (54.54%); cumulated value=6 (66.66%)
+  <=4: sub-population=1 (9.09%); cumulated value=3 (33.33%)
 Distribution of smallers
- population: 9
+ population: 11
  minimum value: 1
- maximum value: 8
- total value: 23
- average value: 2.55
+ maximum value: 10
+ total value: 47
+ average value: 4.27
  distribution:
-  <=1: sub-population=7 (77.77%); cumulated value=7 (30.43%)
-  <=8: sub-population=2 (22.22%); cumulated value=16 (69.56%)
+  <=1: sub-population=7 (63.63%); cumulated value=7 (14.89%)
+  <=16: sub-population=4 (36.36%); cumulated value=40 (85.10%)
 Distribution of direct smallers
- population: 9
+ population: 11
  minimum value: 0
  maximum value: 6
- total value: 7
- average value: 0.77
+ total value: 9
+ average value: 0.81
  distribution:
-  <=0: sub-population=7 (77.77%); cumulated value=0 (0.0%)
-  <=1: sub-population=1 (11.11%); cumulated value=1 (14.28%)
-  <=8: sub-population=1 (11.11%); cumulated value=6 (85.71%)
+  <=0: sub-population=7 (63.63%); cumulated value=0 (0.0%)
+  <=1: sub-population=3 (27.27%); cumulated value=3 (33.33%)
+  <=8: sub-population=1 (9.09%); cumulated value=6 (66.66%)
 ## Class hierarchy
 Number of nodes: 8
 Number of edges: 14 (1.75 per node)
@@ -417,36 +418,36 @@ Distribution of direct smallers
  population: 47
  minimum value: 1
  maximum value: 39
- total value: 265
- average value: 5.63
+ total value: 267
+ average value: 5.68
  distribution:
-  <=1: sub-population=11 (23.40%); cumulated value=11 (4.15%)
-  <=2: sub-population=9 (19.14%); cumulated value=18 (6.79%)
-  <=4: sub-population=9 (19.14%); cumulated value=31 (11.69%)
-  <=8: sub-population=9 (19.14%); cumulated value=54 (20.37%)
-  <=16: sub-population=5 (10.63%); cumulated value=55 (20.75%)
-  <=32: sub-population=3 (6.38%); cumulated value=57 (21.50%)
-  <=64: sub-population=1 (2.12%); cumulated value=39 (14.71%)
+  <=1: sub-population=10 (21.27%); cumulated value=10 (3.74%)
+  <=2: sub-population=9 (19.14%); cumulated value=18 (6.74%)
+  <=4: sub-population=10 (21.27%); cumulated value=34 (12.73%)
+  <=8: sub-population=9 (19.14%); cumulated value=54 (20.22%)
+  <=16: sub-population=5 (10.63%); cumulated value=55 (20.59%)
+  <=32: sub-population=3 (6.38%); cumulated value=57 (21.34%)
+  <=64: sub-population=1 (2.12%); cumulated value=39 (14.60%)
  list:
-  TId: 39 (14.71%)
-  APublicVisibility: 20 (7.54%)
-  AListExprs: 19 (7.16%)
-  ACallExpr: 18 (6.79%)
-  TClassid: 16 (6.03%)
-  TKwend: 10 (3.77%)
-  TNumber: 10 (3.77%)
-  AIntExpr: 10 (3.77%)
-  AType: 9 (3.39%)
-  ASignature: 8 (3.01%)
+  TId: 39 (14.60%)
+  APublicVisibility: 20 (7.49%)
+  AListExprs: 19 (7.11%)
+  ACallExpr: 18 (6.74%)
+  TClassid: 16 (5.99%)
+  TKwend: 10 (3.74%)
+  TNumber: 10 (3.74%)
+  ADecIntExpr: 10 (3.74%)
+  AType: 9 (3.37%)
+  ASignature: 8 (2.99%)
   ...
+  ASelfExpr: 1 (0.37%)
   ACallAssignExpr: 1 (0.37%)
-  TKwreturn: 1 (0.37%)
-  AInternMethPropdef: 1 (0.37%)
-  ATopClassdef: 1 (0.37%)
+  TKwself: 1 (0.37%)
+  AReturnExpr: 1 (0.37%)
   AInterfaceClasskind: 1 (0.37%)
   TKwinterface: 1 (0.37%)
-  AReturnExpr: 1 (0.37%)
-  TKwself: 1 (0.37%)
+  TKwreturn: 1 (0.37%)
+  AInternMethPropdef: 1 (0.37%)
   AMainMethPropdef: 1 (0.37%)
   AMainClassdef: 1 (0.37%)
 ## All identifiers of the AST
@@ -489,10 +490,10 @@ Number of classes: 8
   Number of enum kind: 2 (25.00%)
   Number of class kind: 5 (62.50%)
 
-Number of class definitions: 9
+Number of class definitions: 11
 Number of refined classes: 1 (12.50%)
-Average number of class refinments by classes: 0.12
-Average number of class refinments by refined classes: 1.00
+Average number of class refinments by classes: 0.37
+Average number of class refinments by refined classes: 3.00
 
 Number of properties: 20
   Number of MAttribute: 3 (15.00%)
@@ -527,7 +528,7 @@ Total number of self: 5
 Total number of implicit self: 4 (80.00%)
 --- Construction of tables ---
 Number of runtime classes: 7 (excluding interfaces and abstract classes)
-Average number of composing class definition by runtime class: 2.71
+Average number of composing class definition by runtime class: 4.42
 Total size of tables (classes and instances): 35 (not including stuff like info for subtyping or call-next-method)
 Average size of table by runtime class: 5.00
 Values never redefined: 35 (100.00%)
@@ -545,8 +546,6 @@ Values never redefined: 35 (100.00%)
        blooming mclasses (threshold: 2.388)
           B: 3.0
           C: 3.0
-generating out/nitmetrics_args1.write/project_hierarchy.dot
-generating out/nitmetrics_args1.write/module_hierarchy.dot
 
 # Inheritance metrics
 
@@ -894,6 +893,8 @@ MMethodDef possibly invoked at runtime (by number of CallSites)
   base_simple3#Object#bar: 1 (4.54%)
   base_simple3#Object#foo: 1 (4.54%)
   base_simple3#C#init: 1 (4.54%)
+generating out/nitmetrics_args1.write/project_hierarchy.dot
+generating out/nitmetrics_args1.write/module_hierarchy.dot
 class_hierarchy.dot
 classdef_hierarchy.dot
 inheritance/
index 703206f..264e277 100644 (file)
     \e[1m== refined classes\e[0m
       
       redef interface \e[32m\e[1mObject\e[0m\e[0m
-      \e[30m\e[1mbase_simple3::Object\e[0m\e[0m\e[30m (lines 49-51)\e[0m
+      \e[30m\e[1mbase_simple3::Object\e[0m\e[0m\e[30m (lines 49-49)\e[0m
+      
+      redef interface \e[32m\e[1mObject\e[0m\e[0m
+      \e[30m\e[1mbase_simple3::Object\e[0m\e[0m\e[30m (lines 50-50)\e[0m
+      
+      redef interface \e[32m\e[1mObject\e[0m\e[0m
+      \e[30m\e[1mbase_simple3::Object\e[0m\e[0m\e[30m (lines 51-51)\e[0m
 
index ef1c1c1..ca20ef3 100644 (file)
@@ -1,4 +1,4 @@
-alt/test_combined_assignment_alt1.nit:23,3--9: Error: Method '+' doesn't exists in Object.
-alt/test_combined_assignment_alt1.nit:28,3--9: Error: Method '+' doesn't exists in Object.
+alt/test_combined_assignment_alt1.nit:23,3--8: Error: Method '+' doesn't exists in Object.
+alt/test_combined_assignment_alt1.nit:28,3--8: Error: Method '+' doesn't exists in Object.
 alt/test_combined_assignment_alt1.nit:29,10: Type error: expected Int, got Object
 alt/test_combined_assignment_alt1.nit:49,1--8: Error: Method '+' doesn't exists in Object.
index e9fc9cf..247c591 100644 (file)
 # By Flop
 
 class Gene[T]
-       readable var _a_ : T
+       var a_ : T
        fun a: T
        do
-               return _a_
+               return a_
        end
 
-       init(a:T) do _a_ = a
+       init(a:T) do a_ = a
 
 end
 class GeneBool
        super Gene[Bool]
        fun a=(b: Bool)
        do
-               _a_ = b
+               a_ = b
        end
 
        init(a) do super(a)
index cb61de6..b2b10e6 100644 (file)
 # limitations under the License.
 
 class A
-       readable writable var _a: Int = 0#alt1#
-       #alt1#readable writable var _a: Object = 0
+       var a: Int = 0#alt1#
+       #alt1#var a: Object = 0
        init do end
        fun foo
        do
-               _a += 2
+               a += 2
        end
 
        fun next: Int
        do
-               _a += 1
+               a += 1
                return a
        end
 
index bad6da1..24b69e2 100644 (file)
@@ -18,12 +18,12 @@ import kernel
 
 class Gen1[E, F]
 
-   readable writable var _e: E
-   var _f_: F
-   fun f: F do return _f_ end 
-   fun f=(x: F) do _f_ = x end
+   var e: E
+   var f_: F
+   fun f: F do return f_ end
+   fun f=(x: F) do f_ = x end
 
-   init(e:E) do _e = e
+   init(e:E) do self.e = e
 end
 
 class Gen2[G: Int]
@@ -33,10 +33,10 @@ end
 
 class Gen3[H: Int]
        super Gen1[H, Char]
-   redef readable redef writable redef var _e: H
-   redef var _f_: Char = 'N'
-   redef fun f: Char do return _f_ end 
-   redef fun f=(x: Char) do _f_ = x end
+   redef var e: H redef writable
+   redef var f_: Char redef writable = 'N'
+   redef fun f: Char do return f_ end
+   redef fun f=(x: Char) do f_ = x end
 
    init(e:H) do super(e)
 end