diff options
| author | tanaka takashi <isazaka@gmail.com> | 2026-06-29 21:43:54 +0900 |
|---|---|---|
| committer | tanaka takashi <isazaka@gmail.com> | 2026-06-30 01:23:51 +0900 |
| commit | 4bc721c3bf7589b519c5730d093f704ce56e3f09 (patch) | |
| tree | 38da055ab15fd70f5c92584560ea73486e5ddce0 /tests/support/test.h | |
| parent | 4c6a831aa2a57e2bcc20aa3fc2f1b7172f5be285 (diff) | |
refactor: MCP層をmcpc APIベースに刷新
- 独自JSON-RPC処理をmcpcへ置き換え
- 各MCPツールを個別ソースへ分離
- 共通コンテキストと登録処理を整理
- mcpc互換修正と統合テストを更新
Diffstat (limited to 'tests/support/test.h')
| -rw-r--r-- | tests/support/test.h | 48 |
1 files changed, 48 insertions, 0 deletions
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 <stdio.h> +#include <string.h> + +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 |
