Example #1
0
        public void TestConstructorI()
        {
            HashSet<Object> hs2 = new HashSet<Object>(5);
            Assert.AreEqual(0, hs2.Size(), "Created incorrect HashSet");

            try
            {
                new HashSet<Object>(-1);
            }
            catch (ArgumentException)
            {
                return;
            }

            Assert.Fail("Failed to throw ArgumentException for capacity < 0");
         }
Example #2
0
        public void TestConstructorIF()
        {
            HashSet<Object> hs2 = new HashSet<Object>(5, (float) 0.5);
            Assert.AreEqual(0, hs2.Size(), "Created incorrect HashSet");

            try
            {
                new HashSet<Object>(0, 0);
            }
            catch (ArgumentException)
            {
                return;
            }

            Assert.Fail("Failed to throw ArgumentException for initial load factor <= 0");
         }
Example #3
0
 public void TestConstructorCollection()
 {
     HashSet<Object> hs2 = new HashSet<Object>(Arrays.AsList(objArray));
     for (int counter = 0; counter < objArray.Length; counter++)
     {
         Assert.IsTrue(hs.Contains(objArray[counter]), "HashSet does not contain correct elements");
     }
     Assert.IsTrue(hs2.Size() == objArray.Length, "HashSet created from collection incorrect size");
 }
Example #4
0
 public void TestConstructor()
 {
     HashSet<Object> hs2 = new HashSet<Object>();
     Assert.AreEqual(0, hs2.Size(), "Created incorrect HashSet");
 }