forked from goossaert/hashmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestcase.h
93 lines (69 loc) · 1.68 KB
/
testcase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef HASHMAP_TESTCASE
#define HASHMAP_TESTCASE
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
#include <string.h>
#include <sstream>
#include <stdio.h>
#include <errno.h>
#include <string>
//#include <iostream>
//#include <map>
#include <set>
#include <algorithm>
#include <sys/stat.h>
#include "hashmap.h"
#include "monitoring.h"
namespace hashmap
{
class TestCase {
public:
TestCase() {}
virtual ~TestCase() {}
virtual void run() = 0;
void InsertEntries(uint32_t nb_items, std::set<std::string>& keys);
void RemoveEntries(uint32_t nb_items, std::set<std::string>& keys);
HashMap *hm_;
};
class BatchTestCase: public TestCase {
public:
BatchTestCase(HashMap *hm, uint64_t num_buckets, double load_factor_max, double load_factor_remove) {
hm_ = hm;
num_buckets_ = num_buckets;
load_factor_max_ = load_factor_max;
load_factor_remove_ = load_factor_remove;
}
virtual void run();
private:
uint64_t num_buckets_;
double load_factor_max_;
double load_factor_remove_;
};
class RippleTestCase: public TestCase {
public:
RippleTestCase(HashMap *hm, uint64_t num_buckets, double load_factor_max, double load_factor_remove) {
hm_ = hm;
num_buckets_ = num_buckets;
load_factor_max_ = load_factor_max;
load_factor_remove_ = load_factor_remove;
}
virtual void run();
private:
uint64_t num_buckets_;
double load_factor_max_;
double load_factor_remove_;
};
class LoadingTestCase: public TestCase {
public:
LoadingTestCase(HashMap *hm, uint64_t num_buckets) {
hm_ = hm;
num_buckets_ = num_buckets;
}
virtual void run();
private:
uint64_t num_buckets_;
};
}; // namespace
#endif