Skip to content

Commit

Permalink
art
Browse files Browse the repository at this point in the history
  • Loading branch information
JslYoon committed Sep 27, 2024
1 parent 494be09 commit b138d9b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/bliss/bench_ART.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef BLISS_BENCH_ART
#define BLISS_BENCH_ART

#include "ART.h"
#include "ART.h"

#include <vector>
Expand Down Expand Up @@ -41,9 +40,7 @@ class BlissARTIndex : public BlissIndex<KEY_TYPE, VALUE_TYPE> {
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 {}
Expand Down
9 changes: 9 additions & 0 deletions tests/test_art/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
31 changes: 31 additions & 0 deletions tests/test_art/art_tests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "bliss_index_tests.h"

class BTreeTest : public BlissIndexTest {};

TEST_F(BTreeTest, TestBTree_Sorted) {
index.reset(new bliss::BlissARTIndex<key_type, key_type>());
std::vector<key_type> 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<key_type, key_type>());
std::vector<key_type> 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));
}
}

0 comments on commit b138d9b

Please sign in to comment.