示例#1
0
        static object HugeAndFadedFindTest()
        {
            var tbl = new HashTable(1500000);

            for (var i = 1; i <= tbl.Length; i++)
            {
                tbl.PutPair(i, i * 2);
            }

            for (var i = tbl.Length + 1; i <= (tbl.Length * 1.1); i++)
            {
                if ((object)tbl.GetValueByKey(i) != null)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#2
0
        public void TestSearchingOneElement()
        {
            var rnd         = new Random();
            var table       = new HashTable(10000);
            var toFindKey   = RandomString(10);
            var toFindValue = RandomString(10);

            var put = rnd.Next(0, 1000);

            for (int i = 0; i < 10000; i++)
            {
                if (i == put)
                {
                    table.PutPair(toFindKey, toFindValue);
                }
                else
                {
                    table.PutPair(RandomString(5), RandomString(5));
                }
            }
            Assert.AreEqual(toFindValue, table.GetValueByKey(toFindKey));
        }