def _testInsert(self, hashFunc): table = OpenAddressingHashTable(3) table.hashFunc = hashFunc table.insert(0) table.insert(3) table.insert(6) return table
def _testRemove(self, hashFunc): table = OpenAddressingHashTable(3) table.hashFunc = hashFunc table.insert(0) table.insert(2) table.insert(4) self.assertEquals(table.remove(0), 0) self.assertEquals(table.remove(2), 2) self.assertEquals(table.remove(4), 4) self.assertEquals(table.remove(1), None)
def _testHasElement(self, hashFunc): table = OpenAddressingHashTable(3) table.hashFunc = hashFunc table.insert(0) table.insert(2) table.insert(4) self.assertTrue(table.hasElement(0)) self.assertTrue(table.hasElement(2)) self.assertTrue(table.hasElement(4)) self.assertFalse(table.hasElement(1))