bench/lang: add covar/depthnot and fts_nesting
[nit.git] / benchmarks / languages / bench_typetest_depth_not.nit
1 #!/usr/bin/env nit
2
3 import bench_base
4 import pipeline
5
6 class TypeTestDepthNotGenerator
7 super Generator
8
9 redef fun initnit(res)
10 do
11 res.add "new {classes.last}[Root]"
12 for c in classes.skip_tail(1) do
13 res.add "new {c}[Root]"
14 end
15 end
16
17 redef fun testnit
18 do
19 return "not a isa {classes.last}[Root]"
20 end
21
22 redef fun initjava(res, interfaces)
23 do
24
25 var tagc = ""
26 if interfaces then tagc = "X"
27 res.add "new {tagc}{classes.last}<Root>()"
28 for c in classes.skip_tail(1) do
29 res.add "new {tagc}{c}<Root>()"
30 end
31 end
32
33 redef fun testjava(interfaces)
34 do
35 return "!(a instanceof {classes.last})"
36 end
37
38 redef fun initcsharp(res, interfaces)
39 do
40 var tagc = ""
41 if interfaces then tagc = "X"
42 res.add "new {tagc}{classes.last}<Root>()"
43 for c in classes.skip_tail(1) do
44 res.add "new {tagc}{c}<Root>()"
45 end
46 end
47
48 redef fun testcsharp(interfaces)
49 do
50 return "!(a is {classes.last}<Root>)"
51 end
52
53 redef fun initscala(res, interfaces)
54 do
55 var tagc = ""
56 if interfaces then tagc = "X"
57 res.add "new {tagc}{classes.last}[Root]()"
58 for c in classes.skip_tail(1) do
59 res.add "new {tagc}{c}[Root]()"
60 end
61 end
62
63 redef fun testscala(interfaces)
64 do
65 return "!a.isInstanceOf[{classes.last}[Root]]"
66 end
67
68 redef fun initcpp(res)
69 do
70 res.add "new {classes.last}<Root>()"
71 for c in classes.skip_tail(1) do
72 res.add "new {c}<Root>()"
73 end
74 end
75
76 redef fun testcpp
77 do
78 write "\t\t\t{classes.last}<Root> *to = dynamic_cast<{classes.last}<Root>*>(a);"
79 return "to == 0"
80 end
81
82 redef fun inite(res, se)
83 do
84 res.add "create \{{classes.last}[ROOT]\} a"
85 for c in classes.skip_tail(1) do
86 res.add "create \{{c}[ROOT]\} a"
87 end
88 end
89
90 redef fun teste(se)
91 do
92 write "\t\t\t\t\tto ?= a"
93 return "to = Void"
94 end
95
96 redef fun locale(se)
97 do
98 write "\t\t\tto: {classes.last}[ROOT]"
99 end
100 end
101
102 var g = new TypeTestDepthNotGenerator
103 g.genall