aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_utils.h')
-rw-r--r--test/test_utils.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/test_utils.h b/test/test_utils.h
index f0f0c75..1f36772 100644
--- a/test/test_utils.h
+++ b/test/test_utils.h
@@ -17,6 +17,7 @@
#include "pugl/pugl.h"
#include <math.h>
+#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -156,6 +157,19 @@ perspective(float* m, float fov, float aspect, float zNear, float zFar)
}
static inline int
+logError(const char* fmt, ...)
+{
+ fprintf(stderr, "error: ");
+
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+
+ return 1;
+}
+
+static inline int
printModifiers(const uint32_t mods)
{
return fprintf(stderr, "Modifiers:%s%s%s%s\n",
@@ -286,7 +300,7 @@ puglParseTestOptions(int* pargc, char*** pargv)
break;
} else {
opts.help = true;
- fprintf(stderr, "error: Unknown option: %s\n", argv[i]);
+ logError("Unknown option: %s\n", argv[i]);
}
}