message: Testing reallocation, + refactoring to pass a map around by reference
diff: @@ -23,9 +23,8 @@ Map <Key, T> init()
  }
  template <typename Key, typename T, int N>
  -Map <Key, T> test_storage()
  +void test_storage(Map <Key, T> &test)
  {
  - Map<Key,T> test(N/2, 2);
  for(int i = 0; i < N; i++)
  {
  @@ -37,33 +36,41 @@ Map <Key, T> test_storage()
  }
  auto ret = test.insert(N, 900);
  EXPECT_EQ(false, ret.second);
  - return test;
  }
  template <typename Key, typename T, int N>
  -Map <Key, T> test_remove()
  +void test_remove(Map <Key,T> &test)
  {
  - Map<Key,T> test(N/2, 2);
  + test.remove(13);
  + auto ret = test.find(13);
  + EXPECT_EQ(-2, ret.next);
  + test.insert(13, 900);
  + ret = test.find(13);
  + EXPECT_EQ(900, ret.value);
  +}
  - for(int i = 0; i < N; i++)
  +template <typename Key, typename T, int N>
  +void test_rehash(Map <Key, T> &test)
  {
  - test.insert(i, i*27-N/2);
  - }
  + test.rehash();
  for(int i = 0; i < N; i++){
  EXPECT_EQ(i*27-N/2, test.find(i).value);
  }
  - test.remove(13);
  - auto ret = test.find(13);
  - EXPECT_EQ(-2, ret.next);
  - test.insert(13, 900);
  - ret = test.find(13);
  - EXPECT_EQ(900, ret.value);
  + for(int i = N; i < 2*N; i++)
  + {
  + test.insert(i, i*27-N/2);
  + }
  - return test;
  + for(int i = 0; i < 2*N; i++){
  + EXPECT_EQ(i*27-N/2, test.find(i).value);
  + }
  + auto ret = test.insert(N, 900);
  + EXPECT_EQ(false, ret.second);
  }
  +
  }
  TEST(core_map, initialization)
  @@ -76,14 +83,27 @@ TEST(core_map, initialization)
  TEST(core_map, insertion)
  {
  constexpr int N = 20; /* Number of values to store */
  - Map <int, int> test = internal::test_storage<int, int, N>();
  + Map <int, int> test = internal::init<int, int, N>();
  + internal::test_storage<int,int,N>(test);
  }
  TEST(core_map, removal)
  {
  constexpr int N = 20; /* Number of values to store */
  - Map <int, int> test = internal::test_remove<int, int, N>();
  + Map <int, int> test = internal::init<int, int, N>();
  + internal::test_storage<int, int, N>(test);
  + internal::test_remove<int,int,N>(test);
  +
  +}
  +
  +TEST(core_map, rehash)
  +{
  + constexpr int N = 20; /* Number of values to store */
  + Map <int, int> test = internal::init<int, int, N>();
  + internal::test_storage<int, int, N>(test);
  + internal::test_rehash<int, int, N>(test);
  + internal::test_remove<int,int,N>(test);
  }
  } /* namespace axom */
  