summaryrefslogtreecommitdiff
path: root/test/fixtures/util.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-01-22 12:24:00 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-02-04 10:49:06 +0100
commitaa09aa321b24981bf0f8f2dec97ac100727266a5 (patch)
tree9291597f54e8d86357a285f9ffd426ff435f9387 /test/fixtures/util.hpp
parent8a1fce547e9ad0bf750418c844c9b23a3ee6d8dd (diff)
downloadqtlocation-mapboxgl-aa09aa321b24981bf0f8f2dec97ac100727266a5.tar.gz
rearrange tests and make more robust
Diffstat (limited to 'test/fixtures/util.hpp')
-rw-r--r--test/fixtures/util.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/fixtures/util.hpp b/test/fixtures/util.hpp
new file mode 100644
index 0000000000..f1201d34e7
--- /dev/null
+++ b/test/fixtures/util.hpp
@@ -0,0 +1,24 @@
+#ifndef MBGL_TEST_UTIL
+#define MBGL_TEST_UTIL
+
+#include <gtest/gtest.h>
+
+#define SCOPED_TEST(name) \
+ static class name { \
+ bool completed = false; \
+ public: \
+ void finish() { EXPECT_FALSE(completed) << #name " was already completed."; completed = true; } \
+ ~name() { if (!completed) ADD_FAILURE() << #name " didn't complete."; } \
+ } name;
+
+namespace mbgl {
+namespace test {
+
+const std::string &getBaseDirectory();
+pid_t startServer(const char *executable);
+void stopServer(pid_t pid);
+
+}
+}
+
+#endif