[corlib] Fix a few NSLogWriter issues. (#13799)
[mono-project.git] / mcs / tests / test-anon-60.cs
blob8574c1ca3780e6e509b90a46e9079e487ab4f7af
1 using System;
3 public class X
5 public delegate void TestDelegate ();
7 static long sum_i, sum_j, sum_k;
8 static ulong sum_p, sum_q;
10 public static int Test (int p)
12 TestDelegate d = null;
13 for (int i = 1; i <= 5; i++) {
14 for (int j = i; j <= 8; j++) {
15 int k = i;
16 TestDelegate temp = delegate {
17 Console.WriteLine ("i = {0}, j = {1}, k = {2}, p = {3}",
18 i, j, k, p);
19 sum_i += 1 << i;
20 sum_j += 1 << j;
21 sum_k += 1 << k;
22 sum_p += (ulong) (1 << p);
23 p += k;
25 ulong q = (ulong) (i * j);
27 d += delegate {
28 Console.WriteLine ("Nested i = {0}, j = {1}, " +
29 "k = {2}, p = {3}, q = {4}",
30 i, j, k, p, q);
31 sum_q += q;
34 temp ();
35 d += temp;
38 Console.WriteLine ("SUM i = {0}, j = {1}, k = {2}, p = {3}",
39 sum_i, sum_j, sum_k, sum_p);
40 Console.WriteLine ();
41 if (sum_i != 300)
42 return 1;
43 if (sum_j != 2498)
44 return 2;
45 if (sum_k != 300)
46 return 3;
47 if (sum_p != 1825434804)
48 return 4;
49 sum_i = sum_j = sum_k = 0;
50 sum_p = sum_q = 0;
51 d();
52 Console.WriteLine ("SUM i = {0}, j = {1}, k = {2}, p = {3}, q = {4}",
53 sum_i, sum_j, sum_k, sum_p, sum_q);
54 Console.WriteLine ();
55 if (sum_i != 1920)
56 return 5;
57 if (sum_j != 15360)
58 return 6;
59 if (sum_k != 300)
60 return 7;
61 if (sum_p != 18446744073385831629)
62 return 8;
63 if (sum_q != 455)
64 return 9;
65 return 0;
68 public static int Main ()
70 int result = Test (5);
71 if (result != 0)
72 Console.WriteLine ("ERROR: {0}", result);
73 else
74 Console.WriteLine ("OK");
75 return result;