5 public static void Main (String
[] args
) {
9 Console
.WriteLine ("using System;");
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 ("}");
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 ("}");
24 Console
.WriteLine ("public class Driver");
25 Console
.WriteLine ("{");
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;");
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 ("}");
39 Console
.WriteLine ("return res;");
40 Console
.WriteLine ("}");
43 Console
.WriteLine (" public static int Main () {");
44 Console
.WriteLine (" int res = 0;");
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 ("}");