2 using System.Runtime.InteropServices;
5 delegate void SimpleDelegate ();
9 Console.WriteLine ("Test.F1");
13 Console.WriteLine ("Test.F2");
17 Console.WriteLine ("Test.F4");
21 Console.WriteLine ("Test.F8");
24 public static int Main () {
25 return TestDriver.RunTests (typeof (Tests));
29 static bool check_is_expected_v (SimpleDelegate d, int expected_v)
33 return v == expected_v;
36 static public int test_0_test () {
37 SimpleDelegate d1 = new SimpleDelegate (F1);
38 SimpleDelegate d2 = new SimpleDelegate (F2);
39 SimpleDelegate d4 = new SimpleDelegate (F4);
40 SimpleDelegate d8 = new SimpleDelegate (F8);
44 if (!check_is_expected_v (d1 - d2, 1))
46 if (!check_is_expected_v (d1 - d4, 1))
49 if (!check_is_expected_v (d2 - d1, 2))
53 if (!check_is_expected_v (d2 - d4, 2))
56 if (!check_is_expected_v (d4 - d1, 4))
58 if (!check_is_expected_v (d4 - d2, 4))
63 SimpleDelegate d12 = d1 + d2;
64 SimpleDelegate d14 = d1 + d4;
65 SimpleDelegate d24 = d2 + d4;
67 if (!check_is_expected_v (d12 - d1, 2))
69 if (!check_is_expected_v (d12 - d2, 1))
71 if (!check_is_expected_v (d12 - d4, 3))
74 if (!check_is_expected_v (d14 - d1, 4))
76 if (!check_is_expected_v (d14 - d2, 5))
78 if (!check_is_expected_v (d14 - d4, 1))
81 if (!check_is_expected_v (d14 - d1, 4))
83 if (!check_is_expected_v (d14 - d2, 5))
85 if (!check_is_expected_v (d14 - d4, 1))
88 if (d12 - d12 != null)
90 if (!check_is_expected_v (d12 - d14, 3))
92 if (!check_is_expected_v (d12 - d24, 3))
95 if (!check_is_expected_v (d14 - d12, 5))
97 if (d14 - d14 != null)
99 if (!check_is_expected_v (d14 - d24, 5))
102 if (!check_is_expected_v (d24 - d12, 6))
104 if (!check_is_expected_v (d24 - d14, 6))
106 if (d24 - d24 != null)
109 SimpleDelegate d124 = d1 + d2 + d4;
111 if (!check_is_expected_v (d124 - d1, 6))
113 if (!check_is_expected_v (d124 - d2, 5))
115 if (!check_is_expected_v (d124 - d4, 3))
118 if (!check_is_expected_v (d124 - d12, 4))
120 if (!check_is_expected_v (d124 - d14, 7))
122 if (!check_is_expected_v (d124 - d24, 1))
125 if (d124 - d124 != null)
128 SimpleDelegate d1248 = d1 + d2 + d4 + d8;
130 if (!check_is_expected_v (d1248 - (d1 + d2), 12))
132 if (!check_is_expected_v (d1248 - (d1 + d4), 15))
134 if (!check_is_expected_v (d1248 - (d1 + d8), 15))
136 if (!check_is_expected_v (d1248 - (d2 + d4), 9))
138 if (!check_is_expected_v (d1248 - (d2 + d8), 15))
140 if (!check_is_expected_v (d1248 - (d4 + d8), 3))
143 if (!check_is_expected_v (d1248 - (d1 + d2 + d4), 8))
145 if (!check_is_expected_v (d1248 - (d1 + d2 + d8), 15))
147 if (!check_is_expected_v (d1248 - (d1 + d4 + d8), 15))
149 if (!check_is_expected_v (d1248 - (d2 + d4 + d8), 1))
151 if (!check_is_expected_v (d1248 - (d2 + d4 + d8), 1))
154 if (d1248 - d1248 != null)
160 // Regression test for bug #50366
161 static public int test_0_delegate_equality () {
162 if (new SimpleDelegate (F1) == new SimpleDelegate (F1))