From a44fd4cf3a0c3d7ae33b7664341a0a9bff07aaaa Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Wed, 1 Jul 2026 00:11:08 +0900 Subject: 大規模履歴向けread_messages pagination対応 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/storage_test.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/storage_test.c') diff --git a/tests/storage_test.c b/tests/storage_test.c index 3217095..0e93ad9 100644 --- a/tests/storage_test.c +++ b/tests/storage_test.c @@ -1,10 +1,13 @@ #include "storage/store.h" #include "sys/system.h" +#include "mcp/tools/common/history.h" #include #include #include +#include "base/allocator.h" + static int failures; #define CHECK(value) \ do \ @@ -103,6 +106,31 @@ main(void) CHECK(tiny_store_open(&store, directory) == TINY_STORE_OK); CHECK(tiny_store_entry_count(store) == 2); + { + size_t failure_index; + bool built = false; + for (failure_index = 0; failure_index < 64; ++failure_index) + { + tiny_history_index_t *history; + size_t baseline = tiny_allocator_outstanding(); + tiny_allocator_fail_after(failure_index); + history = tiny_history_index_build(store); + tiny_allocator_reset(); + if (history) + { + const size_t *entries = NULL; + size_t entry_count = 0; + CHECK(tiny_history_index_session(history, "unit", &entries, &entry_count)); + CHECK(entry_count == 2 && entries[0] == 0 && entries[1] == 1); + tiny_history_index_free(history); + CHECK(tiny_allocator_outstanding() == baseline); + built = true; + break; + } + CHECK(tiny_allocator_outstanding() == baseline); + } + CHECK(built); + } for (operation = 0; operation < sizeof(rebuild_failures) / sizeof(rebuild_failures[0]); ++operation) { -- cgit v1.2.3