
#ifndef PREPARE_H
#define PREPARE_H

#include <string>

// hashmaps and hash
#include "./3thparty/abseil-cpp/absl/container/flat_hash_map.h"
#include "./3thparty/abseil-cpp/absl/container/node_hash_map.h"
#include "./3thparty/abseil-cpp/absl/hash/hash.h"
#include "./3thparty/emilib/hash_map.hpp"
#include "./3thparty/parallel_hashmap/phmap.h"
#include "./3thparty/skarupke/bytell_hash_map.hpp"
#include "./3thparty/skarupke/flat_hash_map.hpp"
#include "./3thparty/skarupke/unordered_map.hpp"
#include "./3thparty/tsl/array_map.h"
#include "./3thparty/tsl/hopscotch_map.h"
#include "./3thparty/tsl/ordered_map.h"
#include "./3thparty/tsl/robin_map.h"
#include "./3thparty/tsl/sparse_map.h"
#include "3thparty/robinhood/robin_hood.h"
#include "3thparty/sparsehash/dense_hash_map"
#include "3thparty/sparsehash/sparse_hash_map"
#include <boost/unordered_map.hpp>
#include <unordered_map>

using absl::Hash;
using std::string;

// this is the prepare function, again using template
// this is for all maps which only need this. Below are the ones that
// need something different
template <class T> void prepare(T &map, int size) { map.reserve(size); }

// needs a tombstone marker(a key that's exclusively used to signify something
// is deleted) and it doesn't have a reserve(size) member
void prepare(google::sparse_hash_map<int, int> &map, int size) {
  map.set_deleted_key(-1);
  map.rehash(size);
  map.resize(size);
}

void prepare(google::sparse_hash_map<string, string> &map, int size) {
  map.set_deleted_key("a");
  map.rehash(size);
  map.resize(size);
}

// needs a tombstone marker(a key that's exclusively used to signify something
// is deleted) and an empty key marker
// and it doesn't have a reserve(size) member

void prepare(google::dense_hash_map<int, int> &map, int size) {
  map.set_empty_key(0);
  map.set_deleted_key(-1);
  map.rehash(size);
  map.resize(size);
}

void prepare(google::dense_hash_map<string, string> &map, int size) {
  map.set_deleted_key("a");
  map.set_empty_key("");
  map.rehash(size);
  map.resize(size);
}

// with abseil hash
// this is a repeat of the 4 written above, but with types that accept
// abseil::Hash as hashing function
void prepare(google::sparse_hash_map<int, int, Hash<int>> &map, int size) {
  map.set_deleted_key(-1);
  map.rehash(size);
  map.resize(size);
}

void prepare(google::sparse_hash_map<string, string, Hash<string>> &map,
             int size) {
  map.set_deleted_key("a");
  map.rehash(size);
  map.resize(size);
}

void prepare(google::dense_hash_map<int, int, Hash<int>> &map, int size) {
  map.set_empty_key(0);
  map.set_deleted_key(-1);
  map.rehash(size);
  map.resize(size);
}

void prepare(google::dense_hash_map<string, string, Hash<string>> &map,
             int size) {
  map.set_deleted_key("a");
  map.set_empty_key("");
  map.rehash(size);
  map.resize(size);
}

#endif /* TESTS_H */