Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <martin@novell.com>2006-11-29 23:29:45 +0300
committerMartin Baulig <martin@novell.com>2006-11-29 23:29:45 +0300
commit53e266903ec6b2d822cf5b0c566f6374df5307a4 (patch)
tree9eafdd6861f744be725759ca2166ff7932642843 /mcs/tests/test-anon-58.cs
parenta8b22e0e864c03b8cfd2f2cb5a8075b6611c5553 (diff)
parent4565ff1dd6a3e4b5fe5d3d9abd362206525beaad (diff)
New test.
svn path=/trunk/mcs/; revision=68687
Diffstat (limited to 'mcs/tests/test-anon-58.cs')
-rwxr-xr-xmcs/tests/test-anon-58.cs54
1 files changed, 54 insertions, 0 deletions
diff --git a/mcs/tests/test-anon-58.cs b/mcs/tests/test-anon-58.cs
new file mode 100755
index 00000000000..26837a9bf4e
--- /dev/null
+++ b/mcs/tests/test-anon-58.cs
@@ -0,0 +1,54 @@
+using System;
+
+public class X
+{
+ public delegate void TestDelegate ();
+
+ static long sum_i, sum_k, sum_p;
+
+ public static int Test (int p)
+ {
+ TestDelegate d = null;
+ for (int i = 1; i <= 5; i++) {
+ int k = i;
+ TestDelegate temp = delegate {
+ Console.WriteLine ("i = {0}, k = {1}, p = {2}", i, k, p);
+ sum_i += 1 << i;
+ sum_k += 1 << k;
+ sum_p += 1 << p;
+ p += k;
+ };
+ temp ();
+ d += temp;
+ }
+ Console.WriteLine ("SUM i = {0}, k = {1}, p = {2}", sum_i, sum_k, sum_p);
+ Console.WriteLine ();
+ if (sum_i != 62)
+ return 1;
+ if (sum_k != 62)
+ return 2;
+ if (sum_p != 35168)
+ return 3;
+ sum_i = sum_k = sum_p = 0;
+ d();
+ Console.WriteLine ("SUM i = {0}, k = {1}, p = {2}", sum_i, sum_k, sum_p);
+ Console.WriteLine ();
+ if (sum_i != 320)
+ return 4;
+ if (sum_k != 62)
+ return 5;
+ if (sum_p != 1152385024)
+ return 6;
+ return 0;
+ }
+
+ public static int Main ()
+ {
+ int result = Test (5);
+ if (result != 0)
+ Console.WriteLine ("ERROR: {0}", result);
+ else
+ Console.WriteLine ("OK");
+ return result;
+ }
+}