// unity_test_case.h — host shim for ESP-IDF's TEST_CASE macro.
// Injected via `-include` before each IDF-style test file; the file's own
// `#include "unity.h"` is harmless after this.
#pragma once
#include "unity.h"

typedef void (*host_test_fn_t)(void);
void host_register_test(host_test_fn_t fn, const char *name);

#define HOST_CAT2(a, b) a##b
#define HOST_CAT(a, b)  HOST_CAT2(a, b)

#define HOST_TEST_CASE_IMPL(fn, name_str)                                  \
    static void fn(void);                                                   \
    __attribute__((constructor)) static void HOST_CAT(fn, _register)(void)  \
    { host_register_test(fn, name_str); }                                   \
    static void fn(void)

#define TEST_CASE(name_str, tags) \
    HOST_TEST_CASE_IMPL(HOST_CAT(host_test_line_, __LINE__), name_str)
