* ThreadTest.cs: On 2.0 profile, enable > 0 tests for GetHashCode.
authorGert Driesen <drieseng@users.sourceforge.net>
Sun, 21 Oct 2007 15:01:17 +0000 (15:01 -0000)
committerGert Driesen <drieseng@users.sourceforge.net>
Sun, 21 Oct 2007 15:01:17 +0000 (15:01 -0000)
Added test that asserts if the hashcode of two threads is distinct.

svn path=/trunk/mcs/; revision=87868

mcs/class/corlib/Test/System.Threading/ChangeLog
mcs/class/corlib/Test/System.Threading/ThreadTest.cs

index 43c55737750333443f7cdb7a099ee5f04f1f4b6d..35270978a2ea1162f6483b8bbdf87809dae32ca2 100644 (file)
@@ -1,3 +1,8 @@
+2007-10-21  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * ThreadTest.cs: On 2.0 profile, enable > 0 tests for GetHashCode.
+       Added test that asserts if the hashcode of two threads is distinct.
+
 2007-10-20  Raja R Harinath  <harinath@gmail.com>
 
        * TimerTest.cs (TestHeavyCreationLoad): Don't shadow a variable name.
index 5790b06f08f77952df71d7fdb31251103c3cb9ad..f8ed78d91dc4468d40307efa562395f109db68bd 100644 (file)
@@ -218,8 +218,9 @@ namespace MonoTests.System.Threading
                        C1Test test1 = new C1Test ();
                        Thread tA = new Thread (new ThreadStart (test1.TestMethod));
                        int hA1 = tA.GetHashCode ();
-                       // GetHashCode can legitimately return 0
-                       //Assert.IsTrue (hA1 > 0, "#A1");
+#if NET_2_0
+                       Assert.IsTrue (hA1 > 0, "#A1");
+#endif
                        tA.Start ();
                        int hA2 = tA.GetHashCode ();
                        Assert.AreEqual (hA1, hA2, "#A2");
@@ -233,8 +234,9 @@ namespace MonoTests.System.Threading
                        test1 = new C1Test ();
                        Thread tB = new Thread (new ThreadStart (test1.TestMethod));
                        int hB1 = tB.GetHashCode ();
-                       // GetHashCode can legitimately return 0
-                       //Assert.IsTrue (hB1 > 0, "#B1");
+#if NET_2_0
+                       Assert.IsTrue (hB1 > 0, "#B1");
+#endif
                        tB.Start ();
                        int hB2 = tB.GetHashCode ();
                        Assert.AreEqual (hB1, hB2, "#B2");
@@ -244,6 +246,7 @@ namespace MonoTests.System.Threading
 #if NET_2_0
                        Assert.AreEqual (hB1, tB.ManagedThreadId, "#B4");
 #endif
+                       Assert.IsFalse (hA2 == hB2, "#B5");
                }
 
 #if NET_2_0