]> gitweb.factorcode.org Git - factor.git/blob - basis/tools/coverage/coverage-tests.factor
f61fa71f90440bcb87e514093f9e8220769aed21
[factor.git] / basis / tools / coverage / coverage-tests.factor
1 ! Copyright (C) 2014 Jon Harper.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: arrays kernel sequences sorting tools.coverage
4 tools.coverage.private tools.coverage.testvocab
5 tools.coverage.testvocab.child tools.coverage.testvocab.private
6 tools.test vocabs.loader ;
7
8 { "foo.private" } [ "foo" private-vocab-name ] unit-test
9 { "foo.private" } [ "foo.private" private-vocab-name ] unit-test
10
11 {
12   { halftested mconcat testcond testfry testif testifprivate testmacro untested
13 }
14 } [ "tools.coverage.testvocab" [ ] map-words natural-sort ] unit-test
15
16 { t } [
17   "tools.coverage.testvocab"
18     [ V{ } clone [ [ push ] curry each-word ] keep >array ]
19     [ [ ] map-words ] bi =
20 ] unit-test
21
22 {
23   { testifprivate }
24 } [ "tools.coverage.testvocab.private" [ ] map-words natural-sort ] unit-test
25
26 { t } [
27   "tools.coverage.testvocab.private"
28     [ V{ } clone [ [ push ] curry each-word ] keep >array ]
29     [ [ ] map-words ] bi =
30 ] unit-test
31
32 { 3 } [ \ testif count-callables ] unit-test
33
34 ! Need to reload to flush macro cache
35 ! and have correct coverage statistics
36 {
37   {
38     { halftested { [ ] } }
39     { mconcat { } }
40     { testcond { } }
41     { testfry { } }
42     { testif { } }
43     { testifprivate { } }
44     { testmacro { } }
45     { untested { [ ] } }
46   }
47 } [ "tools.coverage.testvocab" [ reload ] [ test-coverage natural-sort ] bi ] unit-test
48
49 { 0.75 } [ "tools.coverage.testvocab.child" [ reload ] [ %coverage ] bi ] unit-test
50
51 {
52   {
53     {
54         "tools.coverage.testvocab"
55         {
56             { halftested { [ ] } }
57             { mconcat { } }
58             { testcond { } }
59             { testfry { } }
60             { testif { } }
61             { testifprivate { } }
62             { testmacro { } }
63             { untested { [ ] } }
64         }
65     }
66     {
67         "tools.coverage.testvocab.child"
68         { { child-halftested { [ ] } } { foo { } } }
69     }
70 }
71 } [
72   "tools.coverage.testvocab.child" reload
73   "tools.coverage.testvocab" [ reload ] [ test-coverage-recursively ] bi natural-sort
74   [ first2 natural-sort 2array ] map
75 ] unit-test