Merge branch 'master' of https://github.com/mono/mono into issue4328
[mono.git] / mcs / class / System / Test / System.Collections.Generic / SortedListTest.cs
index dcacc78373d7c0efb80cdcc18c6f221903c86327..4ecaba16d467d10d6053b9b74c2c08936ebc79f2 100644 (file)
@@ -464,6 +464,19 @@ namespace MonoTests.System.Collections.Generic
                        Assert.IsTrue(sl.Keys[2] == 3, "NCIC #D3");
                }
 
+               [Test]
+               public void ClearDoesNotTouchCapacity ()
+               {
+                       SortedList<int, int> sl = new SortedList<int, int> ();
+                       for (int i = 0; i < 18; i++) {
+                               sl.Add (i, i);
+                       }
+                       int capacityBeforeClear = sl.Capacity;
+                       sl.Clear ();
+                       int capacityAfterClear = sl.Capacity;
+                       Assert.AreEqual (capacityBeforeClear, capacityAfterClear);
+               }
+
                class Uncomparable : IComparer<double>
                {
                        public int Compare (double x, double y)