Merge pull request #4998 from kumpera/fix_56684
[mono.git] / mono / tests / make-imt-test.cs
1 using System;
2
3 public class Tests
4 {
5         public static void Main (String[] args) {
6                 int low = 2000;
7                 int high = 2000;
8
9                 Console.WriteLine ("using System;");
10                 Console.WriteLine ();
11
12                 for (int count = low; count <= high; ++count) {
13                         Console.WriteLine ("public interface Iface_" + count + " {");
14                         for (int i = 0; i <= count; ++i)
15                                 Console.WriteLine ("    int Method_" + i + " (int a, int b, int c, int d);");
16                         Console.WriteLine ("}");
17
18                         Console.WriteLine ("public class Impl_" + count + " : Iface_" +  count + " {");
19                         for (int i = 0; i <= count; ++i)
20                                 Console.WriteLine ("    public virtual int Method_" + i + " (int a, int b, int c, int d) { return a - b - c -d + " + i + "; }");
21                         Console.WriteLine ("}");
22                 }
23
24                 Console.WriteLine ("public class Driver");
25                 Console.WriteLine ("{");
26
27                 for (int iface = low; iface <= high; ++iface) {
28                         Console.WriteLine ("    static Iface_" + iface + " var_" + iface + " = new Impl_" + iface + " ();");
29                         Console.WriteLine ("    static int Test_" + iface + " () {");
30                         Console.WriteLine ("        int res = 0;");
31                         Console.WriteLine ("        int r;");
32
33                         for (int i = 0; i < iface; ++i) {
34                                 Console.WriteLine (String.Format ("             if ((r = var_{0}.Method_{1} (10,5,3,2)) != {1}) {{", iface, i));
35                                 Console.WriteLine (String.Format ("     Console.WriteLine(\"iface {0} method {1} returned {{0}}\", r);", iface, i));
36                                 Console.WriteLine ("    res = 1;");
37                                 Console.WriteLine ("}");
38                         }
39                         Console.WriteLine ("return res;");
40                         Console.WriteLine ("}");
41                 }
42
43                 Console.WriteLine ("    public static int Main () {");
44                 Console.WriteLine ("        int res = 0;");
45
46                 for (int iface = low; iface <= high; ++iface)
47                         Console.WriteLine (String.Format ("        res |= Test_{0} ();", iface));
48                 Console.WriteLine ("            return res;");
49                 Console.WriteLine ("    }");
50                 Console.WriteLine ("}");
51         }
52 }
53