Ejemplo n.º 1
0
        public void TestInsertMany()
        {
            var ht = new HashConsTable <int, object>();

            for (int i = 0; i < 1000; i++)
            {
                Assert.IsTrue(ht.GetOrAdd(i, () => i, out var _));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Checks insertion into the hash cons table.
 /// </summary>
 /// <param name="ht">The table to use.</param>
 private void Check(HashConsTable <int, object> ht)
 {
     Assert.IsTrue(ht.GetOrAdd(1, () => 1, out var _));
     Assert.IsTrue(ht.GetOrAdd(2, () => 2, out var _));
     Assert.IsFalse(ht.GetOrAdd(1, () => 1, out var _));
 }