public void Test_GetKP(int personCount, double expected) { TestFabrics.Init(personCount, ht); double actual = ht.GetKP(); Assert.AreEqual(Math.Round(expected, 2), actual); }
public void Test_Size(int expPersonCount) { TestFabrics.Init(expPersonCount, ht); int actual = ht.Size(); Assert.AreEqual(expPersonCount, actual); }
public void Test_GetByHashCode(int personCount) { TestFabrics.Init(personCount, ht); Person ini = new Person(1, "Uasya", "Pipirkin", 41); Person p = ht.Get(ini.GetHashCode()); Assert.IsTrue(ini.Equals(p)); }
public void Test_GetByHashCode_Ovarlapped(int personCount) { TestFabrics.Init(personCount, ht); Person ini = new Person(7, "Pupasya", "Lurkin", 47); Person p = ht.Get(ini.GetHashCode()); Assert.IsTrue(ini.Equals(p)); }
public void Test_GetByHashCode_LinearShift(int personCount) { TestFabrics.Init(personCount, ht); Person ini = new Person(4, "Kasya", "Babkin", 44); Person p = ht.Get(ini.GetHashCode()); Assert.IsTrue(ini.Equals(p)); }
public void Test_Clear(int personCount) { TestFabrics.Init(personCount, ht); ht.Clear(); float actual = ht.Size(); Assert.AreEqual(0, actual); }
public void Test_Add_ArgOutOfRange_Exc() { TestFabrics.Init(7, ht); ht.Add(new Person(8, "name", "surname", 48)); ht.Add(new Person(9, "name", "surname", 49)); ht.Add(new Person(10, "name", "surname", 50)); ht.Add(new Person(11, "name", "surname", 51)); Assert.Throws <ArgumentOutOfRangeException>(() => ht.Add(new Person(5, "Sasya", "Lapkin", 45))); }
public void Test_GetPositionByHashCode_LinearShift(int personCount) { TestFabrics.Init(personCount, ht); Person ini = new Person(4, "Kasya2", "Babkin", 44); int expectedPos = ini.GetHashCode() % ht.Capacity; int actualPos = ht.GetPosition(ini.GetHashCode()); Assert.AreEqual(expectedPos, actualPos); }
public void Test_GetPositionByHashCode(int personCount) { TestFabrics.Init(personCount, ht); Person ini = new Person(1, "Uasya", "Pipirkin", 41); int expectedPos = ini.GetHashCode() % ht.Capacity; int actualPos = ht.GetPosition(ini.GetHashCode()); Assert.AreEqual(expectedPos, actualPos); }
public void Test_Add_LinearShift(int personCount) { TestFabrics.Init(personCount, ht); Person p = new Person(4, "Kasya2", "Babkin", 44); ht.Add(p); int expectedPos = p.GetHashCode() % ht.Capacity; int actualPos = ht.GetPosition(p); Assert.AreNotEqual(expectedPos, actualPos); }
public void Test_Add_Ovarlapped(int personCount) { TestFabrics.Init(personCount, ht); Person p = new Person(6, "Figasya2", "Lupkin", 46); ht.Add(p); int expectedPos = p.GetHashCode() % ht.Capacity; int actualPos = ht.GetPosition(p); Assert.Less(actualPos, expectedPos); Assert.AreNotEqual(expectedPos, actualPos); }
public void Test_Delete_Ovarlapped(int personCount) { TestFabrics.Init(personCount, ht); LinearHashTable ini = ht; Person p = new Person(2, "Vasya2", "Pupkin2", 42); ht.Add(p); int expectedPos = p.GetHashCode() % ht.Capacity; int actualPos = ht.GetPosition(p); ht.Delete(p); bool res = ini.Equals(ht); Assert.AreNotEqual(expectedPos, actualPos); Assert.IsTrue(res); }
public void Test_Delete_LinearShift(int personCount) { TestFabrics.Init(personCount, ht); ChainedHashTable ini = ht; Person p = new Person(3, "Vasya2", "Papkin3", 43); ht.Add(p); int expectedPos = p.GetHashCode() % ht.Capacity; int actualPos = ht.GetPosition(p); ht.Delete(p); bool res = ini.Equals(ht); Assert.AreEqual(expectedPos, actualPos); Assert.IsTrue(res); }
public void Test_Add(int personCount) { TestFabrics.Init(personCount, ht); ht.Add(new Person(5, "Sasya", "Lapkin", 45)); TestFabrics.HashTableAddAssert(personCount, ht); }
public void Test_Delete(int personCount) { TestFabrics.Init(personCount, ht); ht.Delete(new Person(1, "Uasya", "Pipirkin", 41)); TestFabrics.HashTableDeleteAssert(personCount, ht); }
public void Test_ToArray(int personCount) { TestFabrics.Init(personCount, ht); TestFabrics.HashTableToArrayAssert(personCount, ht); }
public void Test_Enumerator(int personCount) { TestFabrics.Init(personCount, ht); TestFabrics.HashTableEnumeratorAssert(personCount, ht); }