From c907c88bbe18e500d30c256375bc68e5b671e7e4 Mon Sep 17 00:00:00 2001 From: Jie Yao Date: Sat, 18 Nov 2023 04:25:16 -0700 Subject: [PATCH] add assert --- src/tests/index_btree_benchmark.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/tests/index_btree_benchmark.cpp b/src/tests/index_btree_benchmark.cpp index ed53d095f..2cb648d12 100644 --- a/src/tests/index_btree_benchmark.cpp +++ b/src/tests/index_btree_benchmark.cpp @@ -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(); } @@ -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() { @@ -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() { @@ -289,7 +288,7 @@ 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) { @@ -297,7 +296,7 @@ class IndexBtreeBenchmarkHelper { 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) { @@ -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) {