From cb8618d6fb629ea53d60cfdf9c6117a29584a0bd Mon Sep 17 00:00:00 2001 From: Wojtek Date: Thu, 30 Oct 2025 16:05:13 +0100 Subject: [PATCH] assert fix --- src/dbzero/core/crdt/CRDT_Allocator.cpp | 4 ++-- tests/unit_tests/CapacityTreeTest.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/dbzero/core/crdt/CRDT_Allocator.cpp b/src/dbzero/core/crdt/CRDT_Allocator.cpp index 204bf329..e79e7146 100644 --- a/src/dbzero/core/crdt/CRDT_Allocator.cpp +++ b/src/dbzero/core/crdt/CRDT_Allocator.cpp @@ -508,7 +508,7 @@ namespace db0 } // NOTE: modify invalidates the entire window, therefore dedicated "modify" version is used - assert(alloc_window[1]); + assert(!alloc_window[1].isEnd()); // the additional check is to avoid unnecessary modifications if (alloc_window[1].first->canReclaimSpace(min_size)) { auto &alloc = *m_allocs.modify(alloc_window); @@ -566,7 +566,7 @@ namespace db0 THROWF(db0::BadAddressException) << "Invalid address: " << address; } - assert(alloc_window[1]); + assert(!alloc_window[1].isEnd()); const auto alloc = *alloc_window[1].first; m_alloc_delta -= alloc.m_stride; // modify the central item (i.e. alloc_window[1]) diff --git a/tests/unit_tests/CapacityTreeTest.cpp b/tests/unit_tests/CapacityTreeTest.cpp index f6c89407..b4226bad 100644 --- a/tests/unit_tests/CapacityTreeTest.cpp +++ b/tests/unit_tests/CapacityTreeTest.cpp @@ -57,8 +57,7 @@ namespace tests realms.emplace_back(m_bitspace, page_size); realms.emplace_back(m_bitspace, page_size); auto data = db0::tests::getCPData(); - for (const auto &item: data) { - assert(item.size() == 4); + for (const auto &item: data) { // process line unsigned int op_code = std::get<0>(item); unsigned int realm_id = std::get<1>(item);