Author: martin
Date: 2006-11-14 03:45:16 -0500 (Tue, 14 Nov 2006)
New Revision: 67830
Modified:
branches/martin/anonymous-methods2/work/test-martin-1.cs
Log:
Make this a real regression test.
Modified: branches/martin/anonymous-methods2/work/test-martin-1.cs
===================================================================
--- branches/martin/anonymous-methods2/work/test-martin-1.cs 2006-11-14
08:40:46 UTC (rev 67829)
+++ branches/martin/anonymous-methods2/work/test-martin-1.cs 2006-11-14
08:45:16 UTC (rev 67830)
@@ -1,10 +1,12 @@
using System;
-public class Test
+public class X
{
public delegate void TestDelegate ();
- public static void Main ()
+ static long sum_i, sum_k;
+
+ public static int Test ()
{
TestDelegate d = null;
for (int i = 1; i <= 5; i++) {
@@ -12,11 +14,31 @@
TestDelegate temp = delegate {
Console.WriteLine (i);
Console.WriteLine (k);
- Console.WriteLine ();
+ sum_i += 1 << i;
+ sum_k += 1 << k;
};
temp ();
d += temp;
}
+ Console.WriteLine ();
+ if (sum_i != 62)
+ return 1;
+ if (sum_k != 62)
+ return 2;
+ sum_i = sum_k = 0;
d();
+ if (sum_i != 320)
+ return 3;
+ if (sum_k != 62)
+ return 4;
+ return 0;
}
+
+ public static int Main ()
+ {
+ int result = Test ();
+ if (result != 0)
+ Console.WriteLine ("ERROR: {0}", result);
+ return result;
+ }
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches