summaryrefslogtreecommitdiff
path: root/tests/test.hpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-29 08:11:22 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-29 08:11:22 +0000
commit1fdd096c8011446935396baf447bfed9331f3ff3 (patch)
treeb003f83cd04fd2b17cc94c1f2b790da79ef7f241 /tests/test.hpp
parent6210c21984e9319b04ba84cc9937e92519770295 (diff)
tests: Tests can work without exceptions now
git-svn-id: http://pugixml.googlecode.com/svn/trunk@194 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test.hpp')
-rw-r--r--tests/test.hpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/test.hpp b/tests/test.hpp
index b1e470e..c59bb1c 100644
--- a/tests/test.hpp
+++ b/tests/test.hpp
@@ -1,12 +1,18 @@
#ifndef HEADER_TEST_HPP
#define HEADER_TEST_HPP
+#include "../src/pugixml.hpp"
+
+#if (defined(_MSC_VER) && _MSC_VER==1200) || defined(__DMC__)
+typedef int intptr_t;
+#endif
+
#include <string.h>
#include <math.h>
#include <float.h>
-#include <string>
+#include <setjmp.h>
-#include "../src/pugixml.hpp"
+#include <string>
inline bool test_string_equal(const char* lhs, const char* rhs)
{
@@ -103,6 +109,7 @@ struct test_runner
static test_runner* _tests;
static size_t _memory_fail_threshold;
+ static jmp_buf _failure;
};
struct dummy_fixture {};
@@ -147,7 +154,7 @@ struct dummy_fixture {};
#define CHECK_JOIN(text, file, line) text file #line
#define CHECK_JOIN2(text, file, line) CHECK_JOIN(text, file, line)
-#define CHECK_TEXT(condition, text) if (condition) ; else throw CHECK_JOIN2(text, " at "__FILE__ ":", __LINE__)
+#define CHECK_TEXT(condition, text) if (condition) ; else longjmp(test_runner::_failure, (int)(intptr_t)(CHECK_JOIN2(text, " at "__FILE__ ":", __LINE__)))
#if defined(_MSC_VER) && _MSC_VER == 1200
# define STR(value) "??" // MSVC 6.0 has troubles stringizing stuff with strings w/escaping inside