tests: update tests for model_visitor
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 18 Dec 2015 05:13:10 +0000 (00:13 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Fri, 18 Dec 2015 05:13:52 +0000 (00:13 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/test_model_visitor.nit
tests/sav/test_model_visitor_args1.res

index 9dd07e8..3569400 100644 (file)
@@ -25,17 +25,12 @@ class TestModelVisitor
        super ModelVisitor
 
        redef fun visit(e) do
-               if not doc_only or e.mdoc != null then
-                       cpt.inc(e.class_name)
-               end
+               cpt.inc(e.class_name)
                e.visit_all(self)
        end
 
        # Counter of visited entities (by classnames)
        var cpt = new Counter[String]
-
-       # Do the visitor only count entities with a documentation?
-       var doc_only = false
 end
 
 # The body of the specific work.
@@ -47,12 +42,14 @@ do
 
        print "All entities, including fictive ones:"
        var v = new TestModelVisitor
+       v.min_visibility = private_visibility
        v.include_fictive = true
        v.enter_visit(model)
        v.cpt.print_elements(10)
 
        print "All entities:"
        v = new TestModelVisitor
+       v.min_visibility = private_visibility
        v.enter_visit(model)
        v.cpt.print_elements(10)
 
@@ -65,7 +62,21 @@ do
        print "\nAll documented non-private entities:"
        v = new TestModelVisitor
        v.min_visibility = protected_visibility
-       v.doc_only = true
+       v.include_empty_doc = false
+       v.enter_visit(model)
+       v.cpt.print_elements(10)
+
+       print "\nAll public entities:"
+       v = new TestModelVisitor
+       v.min_visibility = public_visibility
        v.enter_visit(model)
        v.cpt.print_elements(10)
+
+       print "\nAll documented public entities:"
+       v = new TestModelVisitor
+       v.min_visibility = public_visibility
+       v.include_empty_doc = false
+       v.enter_visit(model)
+       v.cpt.print_elements(10)
+
 end
index 5a930fe..b058aab 100644 (file)
@@ -25,14 +25,28 @@ All entities:
 
 All non-private entities:
  list:
-  MMethodDef: 8 (24.24%)
-  MMethod: 7 (21.21%)
-  MClassDef: 7 (21.21%)
-  MClass: 7 (21.21%)
-  MModule: 1 (3.03%)
-  MGroup: 1 (3.03%)
-  MPackage: 1 (3.03%)
-  Model: 1 (3.03%)
+  MMethodDef: 17 (34.00%)
+  MMethod: 15 (30.00%)
+  MClassDef: 7 (14.00%)
+  MClass: 7 (14.00%)
+  MModule: 1 (2.00%)
+  MGroup: 1 (2.00%)
+  MPackage: 1 (2.00%)
+  Model: 1 (2.00%)
 
 All documented non-private entities:
  list:
+
+All public entities:
+ list:
+  MMethodDef: 14 (31.81%)
+  MMethod: 12 (27.27%)
+  MClassDef: 7 (15.90%)
+  MClass: 7 (15.90%)
+  MModule: 1 (2.27%)
+  MGroup: 1 (2.27%)
+  MPackage: 1 (2.27%)
+  Model: 1 (2.27%)
+
+All documented public entities:
+ list: