Merge: Augmented literal strings
[nit.git] / benchmarks / languages / benches / bench_null.nit
1 #!/usr/bin/env nit
2 # This file is part of NIT ( http://www.nitlanguage.org ).
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 import bench_base
17
18 class TypeTestDepthGenerator
19 super Generator
20
21 redef fun initnit(res)
22 do
23 for c in classes do
24 res.add "new {c}[Root]"
25 end
26 end
27
28 redef fun initjava(res, interfaces)
29 do
30
31 var tagc = ""
32 if interfaces then tagc = "X"
33 for c in classes do
34 res.add "new {tagc}{c}<Root>()"
35 end
36 end
37
38 redef fun initcsharp(res, interfaces)
39 do
40 var tagc = ""
41 if interfaces then tagc = "X"
42 for c in classes do
43 res.add "new {tagc}{c}<Root>()"
44 end
45 end
46
47 redef fun initscala(res, interfaces)
48 do
49 var tagc = ""
50 if interfaces then tagc = "X"
51 for c in classes do
52 res.add "new {tagc}{c}[Root]()"
53 end
54 end
55
56 redef fun initcpp(res)
57 do
58 for c in classes do
59 res.add "new {c}<Root>()"
60 end
61 end
62
63 redef fun inite(res, se)
64 do
65 for c in classes do
66 res.add "create \{{c}[ROOT]\}"
67 end
68 end
69
70 redef fun initpython(res)
71 do
72 for c in classes do
73 res.add "{c}()"
74 end
75 end
76 end
77
78 var g = new TypeTestDepthGenerator
79 g.dry = true
80 g.genall