From 4bc721c3bf7589b519c5730d093f704ce56e3f09 Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Mon, 29 Jun 2026 21:43:54 +0900 Subject: refactor: MCP層をmcpc APIベースに刷新 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 独自JSON-RPC処理をmcpcへ置き換え - 各MCPツールを個別ソースへ分離 - 共通コンテキストと登録処理を整理 - mcpc互換修正と統合テストを更新 --- tests/support/test.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/support/test.h (limited to 'tests/support') diff --git a/tests/support/test.h b/tests/support/test.h new file mode 100644 index 0000000..5de3864 --- /dev/null +++ b/tests/support/test.h @@ -0,0 +1,48 @@ +#ifndef TINY_CONVMEM_TEST_SUPPORT_H +#define TINY_CONVMEM_TEST_SUPPORT_H + +#include +#include + +typedef struct tiny_test_state +{ + const char *case_name; + unsigned checks; + unsigned failures; +} tiny_test_state_t; + +#define TINY_TEST_CASE(state, name) ((state)->case_name = (name)) +#define TINY_EXPECT(state, expression) \ + do \ + { \ + (state)->checks++; \ + if (!(expression)) \ + { \ + fprintf(stderr, \ + "%s:%d [%s] expected %s\n", \ + __FILE__, \ + __LINE__, \ + (state)->case_name, \ + #expression); \ + (state)->failures++; \ + } \ + } \ + while (0) +#define TINY_EXPECT_EQ_U64(state, expected, actual) \ + TINY_EXPECT((state), (unsigned long long)(expected) == (unsigned long long)(actual)) +#define TINY_EXPECT_BYTES(state, expected, actual, length) \ + TINY_EXPECT((state), memcmp((expected), (actual), (length)) == 0) + +static inline int +tiny_test_finish(const tiny_test_state_t *state) +{ + if (state->failures == 0) + { + printf("%u checks passed\n", state->checks); + return 0; + } + fprintf(stderr, "%u of %u checks failed\n", state->failures, state->checks); + return 1; +} + +#endif -- cgit v1.2.3