Skip to content

Commit 4b85c94

Browse files
test(unordered_lru_cache): add comprehensive unit tests
Add Boost.Test suite with 17 test cases covering: - Construction and configuration (runtime/compile-time sizing) - Basic API behavior (insert, get, emplace, exists, erase, clear) - LRU and truncation semantics (threshold behavior, recency tracking) - Edge cases (maxSize=1, various threshold combinations) Also optimize truncate_if_needed() to use std::nth_element instead of std::sort for O(N) average complexity instead of O(N log N).
1 parent b08eab3 commit 4b85c94

File tree

3 files changed

+407
-3
lines changed

3 files changed

+407
-3
lines changed

src/Makefile.test.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ BITCOIN_TESTS =\
196196
test/txvalidation_tests.cpp \
197197
test/txvalidationcache_tests.cpp \
198198
test/uint256_tests.cpp \
199+
test/unordered_lru_cache_tests.cpp \
199200
test/util_tests.cpp \
200201
test/validation_block_tests.cpp \
201202
test/validation_chainstate_tests.cpp \

0 commit comments

Comments
 (0)