aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_utils.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-11-18 16:20:33 +0100
committerDavid Robillard <d@drobilla.net>2019-11-18 19:33:16 +0100
commit47beee70b04438f291ba00b6dc9d14ec4a54c662 (patch)
treef26cd7364a69907becdc6e52db13cc8fe583207c /test/test_utils.h
parentdd90f0dc8918e3ebfc4f526e332bfdb71129531f (diff)
downloadpugl-47beee70b04438f291ba00b6dc9d14ec4a54c662.tar.gz
pugl-47beee70b04438f291ba00b6dc9d14ec4a54c662.tar.bz2
pugl-47beee70b04438f291ba00b6dc9d14ec4a54c662.zip
Add test utility function for logging errors
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]);
}
}