#include <stdio.h> #include <kc.h> #include <kc_ut.h> #include <kc_memory.h> #include "ut.h" int main(void) { // UT Setup // suite_assert(); // suite_dl(); // suite_env(); // suite_list_array(); // suite_list_linked(); // suite_lock_guard(); // suite_map(); // suite_memory_dump(); // suite_memory_entry(); // suite_memory_listener(); // suite_memory_mark(); // suite_memory(); // suite_queue(); suite_socket(); // suite_thread(); KcMemory_start(false); KcMemory_start(true); KcUt *ut = KcUt_get_instance(); ut->run(ut); return 0; } //////////////////////////////////////////////////////////////////////////////// // // 以下、メモリ管理操作用 // static int ut_can_alloc_counter = 0; static bool ut_can_alloc( KcMemoryEntry *entry, size_t alignment, size_t size, KcMemoryMark mark, const char *file, const char *func, int line) { UNUSED_VARIABLE(entry); UNUSED_VARIABLE(alignment); UNUSED_VARIABLE(size); UNUSED_VARIABLE(mark); UNUSED_VARIABLE(file); UNUSED_VARIABLE(func); UNUSED_VARIABLE(line); ut_can_alloc_counter--; if (ut_can_alloc_counter < 0) { return false; } return true; } UT_KcMemory_can_alloc_func _ut_can_alloc_func(int counter) { ut_can_alloc_counter = counter; return ut_can_alloc; }