2009-05-10 Andrés G. Aragoneses <aaragoneses@novell.com>
authorAndrés G. Aragoneses <knocte@gmail.com>
Sun, 10 May 2009 20:18:03 +0000 (20:18 -0000)
committerAndrés G. Aragoneses <knocte@gmail.com>
Sun, 10 May 2009 20:18:03 +0000 (20:18 -0000)
* LinkedListTest.cs: Added NotWorking test for #481621,
converted from example code by Andy Hume <andyhume32@yahoo.co.uk>.

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

mcs/class/System/Test/System.Collections.Generic/ChangeLog
mcs/class/System/Test/System.Collections.Generic/LinkedListTest.cs

index 804d03e7cdfcde02949171d08ce71850b3367f1a..aef704d4af4d42d159d1d63a786c31bc86e432fe 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-10  Andrés G. Aragoneses  <aaragoneses@novell.com>
+
+       * LinkedListTest.cs: Added NotWorking test for #481621,
+       converted from example code by Andy Hume <andyhume32@yahoo.co.uk>.
+
 2009-03-11  Zoltan Varga  <vargaz@gmail.com>
 
        * SortedListTest.cs: Add tests for #483985.
index 088cdeaedfc4768fdb73da2d8123aee9e43b0ece..a4f09ff11b5a98e8f229d9176a27c77aae575343 100644 (file)
@@ -127,10 +127,6 @@ namespace MonoTests.System.Collections.Generic
                        intlist.CopyTo (output, 0);
                        for (int i = 0; i < 3; i++)
                                Assert.AreEqual (values [i], output [i]);
-
-                       LinkedList <int> l = new LinkedList <int> ();
-                       values = new int [l.Count];
-                       l.CopyTo (values, 0);
                }
 
                [Test]
@@ -181,7 +177,7 @@ namespace MonoTests.System.Collections.Generic
                {
                        intlist.Remove (null);
                }
-
+               
                [Test, ExpectedException (typeof (InvalidOperationException))]
                public void RemoveInvalidNodeTest ()
                {
@@ -247,6 +243,35 @@ namespace MonoTests.System.Collections.Generic
                        }
                        Assert.AreEqual(3, i);
                }
+               
+               [Test] //bug 481621
+               [Category ("NotWorking")]
+               public void PlayWithNullValues ()
+               {
+                       LinkedList <string> li = new LinkedList <string> ();
+                       li.AddLast ((string)null);
+                       li.AddLast ("abcd");
+                       li.AddLast ((string)null);
+                       li.AddLast ("efgh");
+                       Assert.AreEqual (4, li.Count);
+                       Assert.AreEqual ("efgh", li.Last.Value);
+                       Assert.IsNull (li.First.Value);
+
+                       Assert.IsTrue (li.Remove ((string)null));
+                       Assert.AreEqual (3, li.Count);
+                       Assert.AreEqual ("efgh", li.Last.Value);
+                       Assert.AreEqual ("abcd", li.First.Value);
+
+                       Assert.IsTrue (li.Remove ((string)null));
+                       Assert.AreEqual (2, li.Count);
+                       Assert.AreEqual ("efgh", li.Last.Value);
+                       Assert.AreEqual ("abcd", li.First.Value);
+
+                       Assert.IsFalse (li.Remove ((string)null));
+                       Assert.AreEqual (2, li.Count);
+                       Assert.AreEqual ("efgh", li.Last.Value);
+                       Assert.AreEqual ("abcd", li.First.Value);
+               }
        }
 }