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);
        }
Beispiel #3
0
        public void Test_GetPositionByHashCode_Ovarlapped(int personCount)
        {
            TestFabrics.Init(personCount, ht);
            Person ini = new Person(6, "Figasya2", "Lupkin", 46);

            ht.Add(ini);

            int expectedPos = ini.GetHashCode() % ht.Capacity;
            int actualPos   = ht.GetPosition(ini.GetHashCode());

            Assert.Less(actualPos, expectedPos);
            Assert.AreNotEqual(expectedPos, actualPos);
        }
        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));
        }
Beispiel #5
0
        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(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));
        }
Beispiel #7
0
        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_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);
        }
Beispiel #9
0
        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);
        }