From 0dc4d4db3a91faa799187fd321fcae82b12f9b66 Mon Sep 17 00:00:00 2001 From: pommicket Date: Wed, 18 Oct 2023 23:47:17 -0400 Subject: editorconfig globs, testing "framework" --- ted.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'ted.c') diff --git a/ted.c b/ted.c index 5693092..b704187 100644 --- a/ted.c +++ b/ted.c @@ -162,15 +162,19 @@ void ted_info(Ted *ted, const char *fmt, ...) { va_end(args); } -void ted_log(Ted *ted, const char *fmt, ...) { +void ted_vlog(Ted *ted, const char *fmt, va_list args) { if (!ted->log) return; - - va_list args; - va_start(args, fmt); fprintf(ted->log, "[pid %d, %s] ", ted->pid, ted->frame_time_string); vfprintf(ted->log, fmt, args); - va_end(args); fflush(ted->log); + +} + +void ted_log(Ted *ted, const char *fmt, ...) { + va_list args; + va_start(args, fmt); + ted_vlog(ted, fmt, args); + va_end(args); } @@ -945,3 +949,13 @@ vec2 ted_mouse_pos(Ted *ted) { bool ted_mouse_in_rect(Ted *ted, Rect r) { return rect_contains_point(r, ted->mouse_pos); } + +void ted_test(Ted *ted) { +#define run_test(func) printf("Running " #func "\n"); \ + func(ted); \ + if (ted->message_type == MESSAGE_ERROR) { fprintf(stderr, "ted produced an error.\n"); exit(1); } + run_test(config_test); + +#undef run_test + printf("all good as far as i know :3\n"); +} -- cgit v1.2.3