summaryrefslogtreecommitdiffstats
path: root/tests/include/dynamic_extension.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/include/dynamic_extension.h')
-rw-r--r--tests/include/dynamic_extension.h81
1 files changed, 21 insertions, 60 deletions
diff --git a/tests/include/dynamic_extension.h b/tests/include/dynamic_extension.h
index 326bb72..a1ab20a 100644
--- a/tests/include/dynamic_extension.h
+++ b/tests/include/dynamic_extension.h
@@ -23,26 +23,28 @@
* include statement.
*/
-// #include "testing.h"
-// #include "framework/DynamicExtension.h"
-// #include "framework/scheduling/SerialScheduler.h"
-// #include "shard/ISAMTree.h"
-// #include "query/rangequery.h"
-// #include <check.h>
-// #include <random>
-// #include <set>
+#include "framework/reconstruction/BSMPolicy.h"
+#include "framework/reconstruction/TieringPolicy.h"
+#include "testing.h"
+#include "framework/DynamicExtension.h"
+#include "framework/scheduling/SerialScheduler.h"
+#include "framework/reconstruction/ReconstructionPolicy.h"
+#include "shard/ISAMTree.h"
+#include "query/rangequery.h"
+#include <check.h>
+#include <random>
+#include <set>
// using namespace de;
// typedef Rec R;
// typedef ISAMTree<R> S;
// typedef rq::Query<S> Q;
-// typedef DynamicExtension<S, Q, LayoutPolicy::TEIRING, DeletePolicy::TAGGING, SerialScheduler> DE;
+// typedef DynamicExtension<S, Q, DeletePolicy::TAGGING, SerialScheduler> DE;
+// ReconstructionPolicy<S, Q> *recon = new TieringPolicy<S, Q>(1000, 2);
-
-#include "framework/util/Configuration.h"
START_TEST(t_create)
{
- auto test_de = new DE(100, 1000, 2);
+ auto test_de = new DE(recon, 100);
ck_assert_ptr_nonnull(test_de);
ck_assert_int_eq(test_de->get_record_count(), 0);
@@ -55,7 +57,7 @@ END_TEST
START_TEST(t_insert)
{
- auto test_de = new DE(100, 1000, 2);
+ auto test_de = new DE(recon, 100);
uint64_t key = 0;
uint32_t val = 0;
@@ -76,7 +78,7 @@ END_TEST
START_TEST(t_debug_insert)
{
- auto test_de = new DE(100, 1000, 2);
+ auto test_de = new DE(recon, 100);
uint64_t key = 0;
uint32_t val = 0;
@@ -95,7 +97,7 @@ END_TEST
START_TEST(t_insert_with_mem_merges)
{
- auto test_de = new DE(100, 1000, 2);
+ auto test_de = new DE(recon, 100);
uint64_t key = 0;
uint32_t val = 0;
@@ -114,7 +116,7 @@ START_TEST(t_insert_with_mem_merges)
* BSM grows on every flush, so the height will be different than
* normal layout policies
*/
- if (test_de->Layout == de::LayoutPolicy::BSM) {
+ if (dynamic_cast<const BSMPolicy<S, Q>*>(recon)) {
ck_assert_int_eq(test_de->get_height(), 2);
} else {
ck_assert_int_eq(test_de->get_height(), 1);
@@ -127,7 +129,7 @@ END_TEST
START_TEST(t_range_query)
{
- auto test_de = new DE(100, 1000, 2);
+ auto test_de = new DE(recon, 100);
size_t n = 10000;
std::vector<uint64_t> keys;
@@ -175,7 +177,7 @@ END_TEST
START_TEST(t_tombstone_merging_01)
{
size_t reccnt = 100000;
- auto test_de = new DE(100, 1000, 2);
+ auto test_de = new DE(recon, 100);
auto rng = gsl_rng_alloc(gsl_rng_mt19937);
@@ -224,54 +226,13 @@ START_TEST(t_tombstone_merging_01)
}
END_TEST
-[[maybe_unused]] static DE *create_test_tree(size_t reccnt, size_t memlevel_cnt) {
- auto rng = gsl_rng_alloc(gsl_rng_mt19937);
-
- auto test_de = new DE(1000, 10000, 2);
-
- std::set<Rec> records;
- std::set<Rec> to_delete;
- std::set<Rec> deleted;
-
- while (records.size() < reccnt) {
- uint64_t key = rand();
- uint32_t val = rand();
-
- if (records.find({key, val}) != records.end()) continue;
-
- records.insert({key, val});
- }
-
- for (auto rec : records) {
- ck_assert_int_eq(test_de->insert(rec), 1);
-
- if (gsl_rng_uniform(rng) < 0.05 && !to_delete.empty()) {
- std::vector<Rec> del_vec;
- std::sample(to_delete.begin(), to_delete.end(), std::back_inserter(del_vec), 3, std::mt19937{std::random_device{}()});
-
- for (size_t i=0; i<del_vec.size(); i++) {
- test_de->erase(del_vec[i]);
- to_delete.erase(del_vec[i]);
- deleted.insert(del_vec[i]);
- }
- }
-
- if (gsl_rng_uniform(rng) < 0.25 && deleted.find(rec) == deleted.end()) {
- to_delete.insert(rec);
- }
- }
-
- gsl_rng_free(rng);
-
- return test_de;
-}
START_TEST(t_static_structure)
{
auto rng = gsl_rng_alloc(gsl_rng_mt19937);
size_t reccnt = 100000;
- auto test_de = new DE(100, 1000, 2);
+ auto test_de = new DE(recon, 100);
std::set<Rec> records;
std::set<Rec> to_delete;