summaryrefslogtreecommitdiff
path: root/ted.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-10-18 23:47:17 -0400
committerpommicket <pommicket@gmail.com>2023-10-18 23:47:17 -0400
commit0dc4d4db3a91faa799187fd321fcae82b12f9b66 (patch)
tree01450afdc49764bd8ea486d155a351fd7b6a8d4b /ted.c
parent4d57539ffc2954e5c3b9c42da41511f69c4fcde9 (diff)
editorconfig globs, testing "framework"
Diffstat (limited to 'ted.c')
-rw-r--r--ted.c24
1 files changed, 19 insertions, 5 deletions
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");
+}