|  | @@ -8,8 +8,8 @@ typedef HashMap<int, int, MAP_MIN_CAPACITY> IntMap;
 | 
											
												
													
														|  |  static void testAdd(Test& test) {
 |  |  static void testAdd(Test& test) {
 | 
											
												
													
														|  |      IntMap map;
 |  |      IntMap map;
 | 
											
												
													
														|  |      map.add(5, 4);
 |  |      map.add(5, 4);
 | 
											
												
													
														|  | -    test.checkEqual(true, map.contains(5), "map contains added value");
 |  | 
 | 
											
												
													
														|  | -    test.checkEqual(true, map.search(5, -1) == 4, "map search finds added value");
 |  | 
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(true, map.contains(5), "contains added value");
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(4, map.search(5, -1), "search finds added value");
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  static void testMultipleAdd(Test& test) {
 |  |  static void testMultipleAdd(Test& test) {
 | 
											
										
											
												
													
														|  | @@ -17,20 +17,25 @@ static void testMultipleAdd(Test& test) {
 | 
											
												
													
														|  |      map.add(5, 4);
 |  |      map.add(5, 4);
 | 
											
												
													
														|  |      map.add(10, 3);
 |  |      map.add(10, 3);
 | 
											
												
													
														|  |      map.add(15, 2);
 |  |      map.add(15, 2);
 | 
											
												
													
														|  | -    test.checkEqual(true, map.contains(5), "map contains added value 1");
 |  | 
 | 
											
												
													
														|  | -    test.checkEqual(true, map.contains(10), "map contains added value 2");
 |  | 
 | 
											
												
													
														|  | -    test.checkEqual(true, map.contains(15), "map contains added value 3");
 |  | 
 | 
											
												
													
														|  | -    test.checkEqual(true, map.search(5, -1) == 4, "map search finds added value 1");
 |  | 
 | 
											
												
													
														|  | -    test.checkEqual(true, map.search(10, -1) == 3, "map search finds added value 2");
 |  | 
 | 
											
												
													
														|  | -    test.checkEqual(true, map.search(15, -1) == 2, "map search finds added value 3");
 |  | 
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(true, map.contains(5), "contains added value 1");
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(true, map.contains(10), "contains added value 2");
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(true, map.contains(15), "contains added value 3");
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(4, map.search(5, -1), "search finds added value 1");
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(3, map.search(10, -1), "search finds added value 2");
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(2, map.search(15, -1), "search finds added value 3");
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +static void testSearch(Test& test) {
 | 
											
												
													
														|  | 
 |  | +    IntMap map;
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(-1, map.search(6, -1), "search does not find missing key");
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  static void testAddReplace(Test& test) {
 |  |  static void testAddReplace(Test& test) {
 | 
											
												
													
														|  |      IntMap map;
 |  |      IntMap map;
 | 
											
												
													
														|  |      map.add(5, 4);
 |  |      map.add(5, 4);
 | 
											
												
													
														|  |      map.add(5, 10);
 |  |      map.add(5, 10);
 | 
											
												
													
														|  | -    test.checkEqual(true, map.contains(5), "map contains replaced value");
 |  | 
 | 
											
												
													
														|  | -    test.checkEqual(true, map.search(5, -1) == 10, "map search finds replaced value");
 |  | 
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(true, map.contains(5), "contains replaced value");
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(10, map.search(5, -1), "search finds replaced value");
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  static void testClear(Test& test) {
 |  |  static void testClear(Test& test) {
 | 
											
										
											
												
													
														|  | @@ -39,8 +44,8 @@ static void testClear(Test& test) {
 | 
											
												
													
														|  |      map.add(4, 10);
 |  |      map.add(4, 10);
 | 
											
												
													
														|  |      map.clear();
 |  |      map.clear();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    test.checkEqual(false, map.contains(5), "map does not contain cleared values");
 |  | 
 | 
											
												
													
														|  | -    test.checkEqual(false, map.contains(4), "map does not contain cleared values");
 |  | 
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(false, map.contains(5), "does not contain cleared values");
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(false, map.contains(4), "does not contain cleared values");
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  static void testOverflow(Test& test) {
 |  |  static void testOverflow(Test& test) {
 | 
											
										
											
												
													
														|  | @@ -49,15 +54,16 @@ static void testOverflow(Test& test) {
 | 
											
												
													
														|  |          map.add(i, i);
 |  |          map.add(i, i);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |      for(int i = 0; i < MAP_MIN_CAPACITY; i++) {
 |  |      for(int i = 0; i < MAP_MIN_CAPACITY; i++) {
 | 
											
												
													
														|  | -        test.checkEqual(true, map.contains(i), "map still contains values after overflow");
 |  | 
 | 
											
												
													
														|  | 
 |  | +        test.checkEqual(true, map.contains(i), "still contains values after overflow");
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    test.checkEqual(true, true, "map survives overflow");
 |  | 
 | 
											
												
													
														|  | 
 |  | +    test.checkEqual(true, true, "survives overflow");
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  void HashMapTests::test() {
 |  |  void HashMapTests::test() {
 | 
											
												
													
														|  |      Test test("HashMap");
 |  |      Test test("HashMap");
 | 
											
												
													
														|  |      testAdd(test);
 |  |      testAdd(test);
 | 
											
												
													
														|  |      testMultipleAdd(test);
 |  |      testMultipleAdd(test);
 | 
											
												
													
														|  | 
 |  | +    testSearch(test);
 | 
											
												
													
														|  |      testAddReplace(test);
 |  |      testAddReplace(test);
 | 
											
												
													
														|  |      testClear(test);
 |  |      testClear(test);
 | 
											
												
													
														|  |      testOverflow(test);
 |  |      testOverflow(test);
 |