Author: zoltan
Date: 2007-10-18 17:13:23 -0400 (Thu, 18 Oct 2007)
New Revision: 87801

Modified:
   trunk/mono/mono/tests/ChangeLog
   trunk/mono/mono/tests/interlocked.cs
Log:
2007-10-18  Zoltan Varga  <[EMAIL PROTECTED]>

        * interlocked.cs: Add a test for CompareExchange and negative values.


Modified: trunk/mono/mono/tests/ChangeLog
===================================================================
--- trunk/mono/mono/tests/ChangeLog     2007-10-18 21:10:39 UTC (rev 87800)
+++ trunk/mono/mono/tests/ChangeLog     2007-10-18 21:13:23 UTC (rev 87801)
@@ -1,3 +1,7 @@
+2007-10-18  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * interlocked.cs: Add a test for CompareExchange and negative values.
+
 2007-10-17  Mark Probst  <[EMAIL PROTECTED]>
 
        * bug-331798-tb.2.cs: added for Rodrigo

Modified: trunk/mono/mono/tests/interlocked.cs
===================================================================
--- trunk/mono/mono/tests/interlocked.cs        2007-10-18 21:10:39 UTC (rev 
87800)
+++ trunk/mono/mono/tests/interlocked.cs        2007-10-18 21:13:23 UTC (rev 
87801)
@@ -22,27 +22,35 @@
                if (it.test != 1)
                        return 2;
 
+               it.test = -2;
+               c = Interlocked.CompareExchange (ref it.test, 1, -2);
+               if (c != -2)
+                       return 3;
+
+               if (it.test != 1)
+                       return 4;
+
                a = 1;
                b = Interlocked.Increment (ref a);
                if (a != 2)
-                       return 3;
+                       return 5;
                if (b != 2)
-                       return 4;
+                       return 6;
 
                a = 2;
                b = Interlocked.Decrement (ref a);
                if (b != 1)
-                       return 3;
+                       return 7;
                if (a != 1)
-                       return 4;
+                       return 8;
 
                string s = IncTest ();
                if (s != "A1")
-                       return 5;
+                       return 9;
 
                s = IncTest ();
                if (s != "A2")
-                       return 6;
+                       return 10;
 
                Thread.MemoryBarrier ();
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to