 // A new instance of this class will be created for each *TEST(MapTest, ...)
 // Put all repeated stuff for each test here
 template <class T>
-class MapTest : public testing::Test 
-{
-public:
+struct MapTest : public testing::Test 
+{
   using key_type = typename T::key_type;
   using value_type = typename T::value_type;
-
-
-  concurrent_unordered_map<key_type, 
-                                value_type, 
-                                std::numeric_limits<key_type>::max() > the_map;
+  using map_type = concurrent_unordered_map<key_type, value_type, std::numeric_limits<key_type>::max()>;
+
+  std::unique_ptr<map_type> the_map;
 
   const key_type unused_key = std::numeric_limits<key_type>::max();
   const value_type unused_value = std::numeric_limits<value_type>::max();


template<typename map_type, typename Aggregation_Operator>
__global__ void build_table(map_type * const the_map,
                            const typename map_type::key_type* const input_keys,
                            const typename map_type::mapped_type* const input_values,
                            const typename map_type::size_type input_size,
                            Aggregation_Operator op)
{

  using size_type = typename map_type::size_type;

  const size_type i = threadIdx.x + blockIdx.x * blockDim.x;

  if( i < input_size ){
    the_map->insert(thrust::make_pair(input_keys[i], input_values[i]), op);
  }

}

TYPED_TEST(MapTest, AggregationTestDevice)
{
  using key_type = typename TypeParam::key_type;
  using value_type = typename TypeParam::value_type;

  std::vector<key_type>   keys   {0, 0, 0, 5, 5, 5, 10, 10, 10, 11, 12, 13};
  std::vector<value_type> values {0, 1, 2, 5, 5, 4, 13, 12, 11,  6, 97, 42};

  thrust::device_vector<key_type> d_keys{keys};
  thrust::device_vector<value_type> d_values{values};


  //using size_type = typename (this->the_map)::size_type;
  //size_type input_size = keys.size();

  //auto max = [] __device__ (value_type a, value_type b) { return (a >= b ? a : b); };

  //build_table<<<1,256>>>(&(this->the_map),
  //                        thrust::raw_pointer_cast(d_keys.data()),
  //                        thrust::raw_pointer_cast(d_values.data()),
  //                        input_size,
  //                        max);



}



  // Insert every pair into the map
  for(const auto& it : pairs){
    this->the_map->insert(it);
  }

  // Make sure all the pairs are in the map
  for(const auto& it : pairs){
    auto found = this->the_map->find(it.first);
    EXPECT_NE(found, this->the_map->end());
    EXPECT_EQ(found->first, it.first);
    EXPECT_EQ(found->second, it.second);
  }
