static void Test1() { Hash_DoubleHashing <int, string> h = new Hash_DoubleHashing <int, string>(4); //should be size 5 h.Add(1, "1"); h.Add(6, "6"); //should step over 1 h.Delete(1, out string _); try { h.Add(6, "6"); //should fail } catch (Exception) { Console.WriteLine("Test Successful!"); return; } Console.WriteLine("Test Failed!"); }
static void Test2() { Hash_DoubleHashing <int, string> h = new Hash_DoubleHashing <int, string>(3) //should be size 5 { { 1, "1" }, { 6, "6" } }; h.Delete(1, out string _); h.Add(1, "1"); }
//Tests #region PreMade dynamic Tests With UserInput static void TestAdd(Hash_DoubleHashing <int, string> h) { int addAmount = GetNum("\nHow many to add => "); Console.WriteLine(); for (int i = 0; i < addAmount; i++) { try { h.Add(GetNum("Key => "), GetWord("Value => ")); Console.WriteLine($"Added\n"); } catch (ArgumentException e) { Console.WriteLine($"FAILED => {e.Message}\n"); i--; } } }