Browse Source

more tests

svn path=/trunk/mcs/; revision=121706
Jb Evain 17 năm trước cách đây
mục cha
commit
dee331ec14

+ 22 - 0
mcs/class/System.Core/Test/System.Collections.Generic/HashSetTest.cs

@@ -313,6 +313,28 @@ namespace MonoTests.System.Collections.Generic {
 			AssertContainsOnly (res, data);
 		}
 
+		[Test]
+		public void TestCopyToEmpty ()
+		{
+			var set = new HashSet<int> ();
+
+			var res = new int [0];
+			set.CopyTo (res, 0);
+		}
+
+		[Test]
+		public void TestCopyToPrecise ()
+		{
+			var set = new HashSet<int> ();
+			set.Add (42);
+
+			var dest = new int [12];
+
+			set.CopyTo (dest, 6, 1);
+
+			Assert.AreEqual (42, dest [6]);
+		}
+
 		static void AssertContainsOnly<T> (IEnumerable<T> result, IEnumerable<T> data)
 		{
 			Assert.AreEqual (result.Count (), data.Count ());