diff --git a/src/bliss/bench_ART.h b/src/bliss/bench_ART.h index c5e2be9..4c0c675 100644 --- a/src/bliss/bench_ART.h +++ b/src/bliss/bench_ART.h @@ -1,7 +1,6 @@ #ifndef BLISS_BENCH_ART #define BLISS_BENCH_ART -#include "ART.h" #include "ART.h" #include @@ -41,9 +40,7 @@ class BlissARTIndex : public BlissIndex { void put(KEY_TYPE key, VALUE_TYPE value) override { uint8_t ARTkey[KEY_SIZE]; ART::loadKey(key, ARTkey); - - uint8_t depth = 0; - ART::insert(_index, &_index, ARTkey, depth, value, VALUE_SIZE); + ART::insert(_index, &_index, ARTkey, 0, key, 8); } void end_routine() override {} diff --git a/tests/test_art/CMakeLists.txt b/tests/test_art/CMakeLists.txt new file mode 100644 index 0000000..b44a9ac --- /dev/null +++ b/tests/test_art/CMakeLists.txt @@ -0,0 +1,9 @@ +get_filename_component(EXEC ${CMAKE_CURRENT_SOURCE_DIR} NAME) +file(GLOB_RECURSE CPP_TESTS "*_tests.cpp") +add_executable(${EXEC} ${CPP_TESTS}) +target_link_libraries(${EXEC} PRIVATE +bliss +bliss_test_infra +GTest::gtest_main) +include(GoogleTest) +gtest_discover_tests(${EXEC}) \ No newline at end of file diff --git a/tests/test_art/art_tests.cpp b/tests/test_art/art_tests.cpp new file mode 100644 index 0000000..9bcefea --- /dev/null +++ b/tests/test_art/art_tests.cpp @@ -0,0 +1,31 @@ +#include "bliss_index_tests.h" + +class BTreeTest : public BlissIndexTest {}; + +TEST_F(BTreeTest, TestBTree_Sorted) { + index.reset(new bliss::BlissARTIndex()); + std::vector data; + GenerateData(data, num_keys); + + auto insert_start = data.begin(); + auto insert_end = data.end(); + executor::execute_inserts(*index, insert_start, insert_end); + + for (auto key : data) { + EXPECT_TRUE(index->get(key)); + } +} + +TEST_F(BTreeTest, TestBTree_Random) { + index.reset(new bliss::BlissARTIndex()); + std::vector data; + GenerateData(data, num_keys, false); + + auto insert_start = data.begin(); + auto insert_end = data.end(); + executor::execute_inserts(*index, insert_start, insert_end); + + for (auto key : data) { + EXPECT_TRUE(index->get(key)); + } +} \ No newline at end of file