we can test 19 libs now!!!

This commit is contained in:
TinyAtoms
2020-02-06 22:28:32 -03:00
parent f12d25a595
commit 24ff483dd6
44 changed files with 40831 additions and 61 deletions

View File

@@ -7,35 +7,20 @@
#include <iterator>
#include <chrono>
// maps
// #include <sparsehash/sparse_hash_map>
// own
#include "./generator.h"
#include "./prepare.h"
using namespace std::chrono;
using std::vector;
using std::string;
using std::cout;
// since my testing is based on this function, this one doesn't need no prep
void prepare(std::unordered_map<int, int>& map,int size){
map.reserve(size);
return;
}
void prepare(std::unordered_map<string, string>& map,int size){
map.reserve(size);
return;
}
// void prepare(google::sparse_hash_map<int, int>& map, int size){
// map.set_deleted_key(0);
// return;
// }
template <class T>
vector<int> int_test(T testmap, int size){
vector<int> int_test(T map, int size){
vector<int> results; // insert, lookup, unsuccesful lookup, delete times
vector<int> sample_keys; // get a sample of keys to lookup and later delete
@@ -47,7 +32,7 @@ vector<int> int_test(T testmap, int size){
vector<int> insert_keys(10000);
std::generate(insert_keys.begin(), insert_keys.end(), gen_int);
// T testmap {};
T testmap{};
prepare(testmap, size); // do special actions, such as setting the tombstone marker for other, more exotic hashmaps
{ // seperate scope, so all_keys gets destroyed. for good measure, empty it too
@@ -120,8 +105,6 @@ vector<int> int_test(T testmap, int size){
template <class T>
vector<int> string_test(T map, int size){
vector<int> results; // insert, lookup, unsuccesful lookup, delete times
@@ -135,7 +118,8 @@ vector<int> string_test(T map, int size){
vector<string> insert_keys(10000);
std::generate(insert_keys.begin(), insert_keys.end(), gen_string);
T testmap {};
T testmap{};
prepare(testmap, size); // do special actions, such as setting the tombstone marker for other, more exotic hashmaps
{ // seperate scope, so all_keys gets destroyed. for good measure, empty it too