def test_Add3(self): counterHashMap1 = CounterHashMap() for i in range(1000): counterHashMap1.put(i) counterHashMap2 = CounterHashMap() for i in range(500, 1000): counterHashMap2.putNTimes(1000 + i, i + 1) counterHashMap1.add(counterHashMap2) self.assertEquals(1500, len(counterHashMap1))
def test_Add2(self): counterHashMap1 = CounterHashMap() counterHashMap1.put("item1") counterHashMap1.put("item2") counterHashMap1.put("item1") counterHashMap1.put("item2") counterHashMap1.put("item1") counterHashMap2 = CounterHashMap() counterHashMap2.put("item4") counterHashMap2.putNTimes("item5", 4) counterHashMap2.put("item2") counterHashMap1.add(counterHashMap2) self.assertEquals(3, counterHashMap1.count("item1")) self.assertEquals(3, counterHashMap1.count("item2")) self.assertEquals(1, counterHashMap1.count("item4")) self.assertEquals(4, counterHashMap1.count("item5"))
def test_Add1(self): counterHashMap1 = CounterHashMap() counterHashMap1.put("item1") counterHashMap1.put("item2") counterHashMap1.put("item3") counterHashMap1.put("item1") counterHashMap1.put("item2") counterHashMap1.put("item1") counterHashMap2 = CounterHashMap() counterHashMap2.putNTimes("item1", 2) counterHashMap2.putNTimes("item2", 3) counterHashMap2.putNTimes("item3", 6) counterHashMap2.putNTimes("item1", 2) counterHashMap2.putNTimes("item2", 3) counterHashMap2.putNTimes("item1", 2) counterHashMap1.add(counterHashMap2) self.assertEquals(9, counterHashMap1.count("item1")) self.assertEquals(8, counterHashMap1.count("item2")) self.assertEquals(7, counterHashMap1.count("item3"))