Skip to content

Commit

Permalink
add assert
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonYao287 committed Nov 18, 2023
1 parent dd2a73b commit c907c88
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/tests/index_btree_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ class IndexBtreeBenchmarkHelper {
using T = BenchmarkType;
using K = typename BenchmarkType::KeyType;
using V = typename BenchmarkType::ValueType;
// using op_func_t = std::function< void(void) >;

IndexBtreeBenchmarkHelper() { setup(); }

Expand Down Expand Up @@ -222,7 +221,7 @@ class IndexBtreeBenchmarkHelper {
auto preq = BtreeRangePutRequest< K >{BtreeKeyRange< K >{start_key, true, end_key, true},
btree_put_type::UPDATE, &value};
auto ret = m_btree->put(preq);
if (ret != btree_status_t::success) { LOGERROR("range_update failed"); }
HS_REL_ASSERT_EQ(ret, btree_status_t::success, "range_update failed");
}

void range_remove() {
Expand All @@ -231,7 +230,7 @@ class IndexBtreeBenchmarkHelper {
K end_key = K{num_entries - 1};
auto rreq = BtreeRangeRemoveRequest< K >{BtreeKeyRange< K >{start_key, true, end_key, true}};
auto ret = m_btree->remove(rreq);
if (ret != btree_status_t::success) { LOGERROR("range_removequit failed"); }
HS_REL_ASSERT_EQ(ret, btree_status_t::success, "range_remove failed");
}

void range_query() {
Expand Down Expand Up @@ -289,15 +288,15 @@ class IndexBtreeBenchmarkHelper {
K key = K{k};
auto sreq = BtreeSinglePutRequest{&key, &value, put_type};
auto ret = m_btree->put(sreq);
if (ret != btree_status_t::success) { LOGERROR("put failed"); }
HS_REL_ASSERT_EQ(ret, btree_status_t::success, "put failed");
}

void do_get(uint64_t k) {
K key = K{k};
V value;
auto req = BtreeSingleGetRequest{&key, &value};
auto ret = m_btree->get(req);
if (ret != btree_status_t::success) { LOGERROR("get failed"); }
HS_REL_ASSERT_EQ(ret, btree_status_t::success, "get failed");
}

void do_remove(uint32_t k) {
Expand All @@ -306,7 +305,7 @@ class IndexBtreeBenchmarkHelper {

auto rreq = BtreeSingleRemoveRequest{key.get(), existing_v.get()};
auto ret = m_btree->remove(rreq);
if (ret != btree_status_t::success) { LOGERROR("remove failed"); }
HS_REL_ASSERT_EQ(ret, btree_status_t::success, "remove failed");
}

void run_in_parallel(function< void(uint32_t) > cb) {
Expand Down

0 comments on commit c907c88

Please sign in to comment.