#ifndef UT_H #define UT_H #include <kc.h> #include <kc_memory_entry.h> extern void suite_assert(void); extern void suite_list_array(void); extern void suite_list_linked(void); extern void suite_lock_guard(void); extern void suite_memory_dump(void); extern void suite_memory_entry(void); extern void suite_memory_listener(void); extern void suite_memory_mark(void); extern void suite_memory(void); extern void suite_queue(void); extern bool (*_UT_KcMemory_can_alloc)( KcMemoryEntry *entry, size_t alignment, size_t size, KcMemoryMark mark, const char *file, const char *func, int line); typedef bool (*UT_KcMemory_can_alloc_func)( KcMemoryEntry *entry, size_t alignment, size_t size, KcMemoryMark mark, const char *file, const char *func, int line); UT_KcMemory_can_alloc_func _ut_can_alloc_func(int counter); /** * ut_alloc_control(0) * { * // メモリ確保失敗させたい処理 * } * * ut_alloc_control(1) * { * // 2回目にメモリ確保失敗させたい処理 * } */ #define ut_alloc_control(counter) \ for (_UT_KcMemory_can_alloc = _ut_can_alloc_func(counter); _UT_KcMemory_can_alloc != NULL; _UT_KcMemory_can_alloc = NULL) #endif // UT_H