def testSetElementInHashMap(self): h = hashmap(5) self.assertTrue(h.set("key1", "val1"))
def testHashMapConstructor(self): h = hashmap(5) self.failUnless(h)
def testInvalidSizeException(self): try: h = hashmap(0) self.failUnless(False) except ValueError: self.failUnless(True)
def testValueDeletedFromHashMap(self): h = hashmap(5) h.set("key1", "val1") h.delete("key1") self.assertIsNone(h.get("key1"))
def testLoad(self): h = hashmap(4) h.set("key1", "val1") self.assertEqual(h.load(), 0.25)
def testValueOverwrittenInHashMap(self): h = hashmap(5) h.set("key1", "val1") h.set("key1", "val2") self.assertIs(h.get("key1"), "val2")
def testValueStoredInHashMap(self): h = hashmap(5) h.set("key1", "val1") self.assertIs(h.get("key1"), "val1")
def testGetElementNotInHashMap(self): h = hashmap(5) self.assertIsNone(h.get("key1"))
def testGetElementInHashMap(self): h = hashmap(5) h.set("key1", "val1") self.assertIsNotNone(h.get("key1"))
def testHashMapFull(self): h = hashmap(2) h.set("key1", "val1") h.set("key2", "val2") self.assertFalse(h.set("key3", "val3"))