summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-06-21 10:55:43 +0200
committerljfa-ag <ljfa-ag@web.de>2015-06-21 11:17:20 +0200
commit483714e26ef6fca97353ca34654e5588bc61dda0 (patch)
tree6f266e108b4b3a02923520cdf8d1bbbaf50157b2 /test
parent8458a8d07f5990c33c15acfa2ac316b0a9d6ede0 (diff)
downloadProject-Tick-483714e26ef6fca97353ca34654e5588bc61dda0.tar.gz
Project-Tick-483714e26ef6fca97353ca34654e5588bc61dda0.zip
Add tag.h
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt6
-rw-r--r--test/microtest.h14
-rw-r--r--test/nbttest.cpp9
3 files changed, 29 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000000..04672d2666
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,6 @@
+enable_testing()
+include_directories(${libnbt++_SOURCE_DIR}/include)
+
+add_executable(nbttest nbttest.cpp)
+target_link_libraries(nbttest nbt++)
+add_test(nbttest nbttest)
diff --git a/test/microtest.h b/test/microtest.h
new file mode 100644
index 0000000000..8691ebb748
--- /dev/null
+++ b/test/microtest.h
@@ -0,0 +1,14 @@
+#ifndef MICROTEST_H
+#define MICROTEST_H
+
+#include <type_traits>
+
+#define FAIL_TEST { std::cerr << "Assertion failed at " __FILE__ ":" << __LINE__ << std::endl; \
+ exit(EXIT_FAILURE); }
+#define ASSERT(expr) { if(!(expr)) FAIL_TEST }
+#define EXPECT_EXCEPTION(expr, type) { \
+ try { (expr); std::cerr << "Expected " #type " to be thrown" << std::endl; FAIL_TEST } \
+ catch(type&) {} \
+ catch(...) { std::cerr << "Expected " #type " to be thrown" << std::endl; FAIL_TEST } }
+
+#endif
diff --git a/test/nbttest.cpp b/test/nbttest.cpp
new file mode 100644
index 0000000000..eead43efd0
--- /dev/null
+++ b/test/nbttest.cpp
@@ -0,0 +1,9 @@
+#include "microtest.h"
+#include "tag.h"
+#include <cstdlib>
+#include <iostream>
+
+int main()
+{
+ return EXIT_SUCCESS;
+}