コード例 #1
0
 def test_get_keys_three_items_hashmap_positive(self):
     hmap = Hashmap()
     keys = [123, "asda", 1023]
     for key in keys:
         hmap.insert(key, "dummy")
     ret_keys = hmap.keys()
     keys.sort(key=lambda x: hash(x))
     ret_keys.sort(key=lambda x: hash(x))
     self.assertEqual(keys, ret_keys)
コード例 #2
0
 def test_insert_few_items_in_hashmap_size_one_positive(self):
     hmap = Hashmap(1)
     keys = [123, "asda", 1023]
     for key in keys:
         hmap.insert(key, "dummy")
     ret_keys = hmap.keys()
     keys.sort(key=lambda x: hash(x))
     ret_keys.sort(key=lambda x: hash(x))
     self.assertEqual(keys, ret_keys)
コード例 #3
0
 def test_get_keys_empty_hashmap_positive(self):
     hmap = Hashmap()
     keys = []
     ret_keys = hmap.keys()
     self.assertEqual(keys, ret_keys)