summaryrefslogtreecommitdiff
path: root/testsuite/backend/genesys/minigtest.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-02-02 17:13:42 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-02-02 17:13:42 +0100
commit3dade5db2a37543f19f0967901d8d80a52a1e459 (patch)
tree808b2499b54563b3290f34d70d159b1024310873 /testsuite/backend/genesys/minigtest.h
parent5bb4cf12855ec0151de15d6c5a2354ff08766957 (diff)
parentffa8801644a7d53cc1c785e3450f794c07a14eb0 (diff)
Update upstream source from tag 'upstream/1.0.29'
Update to upstream version '1.0.29' with Debian dir 2d358af604988ebe4348e38096245d66036fe5ed
Diffstat (limited to 'testsuite/backend/genesys/minigtest.h')
-rw-r--r--testsuite/backend/genesys/minigtest.h38
1 files changed, 36 insertions, 2 deletions
diff --git a/testsuite/backend/genesys/minigtest.h b/testsuite/backend/genesys/minigtest.h
index 752efe1..9a38e77 100644
--- a/testsuite/backend/genesys/minigtest.h
+++ b/testsuite/backend/genesys/minigtest.h
@@ -38,7 +38,7 @@ inline void print_location(std::ostream& out, const char* function, const char*
template<class T, class U>
void check_equal(const T& t, const U& u, const char* function, const char* path, unsigned line)
{
- if (t != u) {
+ if (!(t == u)) {
s_num_failures++;
std::cerr << "FAILURE at ";
print_location(std::cerr, function, path, line);
@@ -64,14 +64,48 @@ inline void check_true(bool x, const char* function, const char* path, unsigned
std::cerr << "\n";
}
+inline void check_raises_success(const char* function, const char* path, unsigned line)
+{
+ s_num_successes++;
+ std::cerr << "SUCCESS at ";
+ print_location(std::cerr, function, path, line);
+ std::cerr << "\n";
+}
+
+inline void check_raises_did_not_raise(const char* function, const char* path, unsigned line)
+{
+ s_num_failures++;
+ std::cerr << "FAILURE at ";
+ print_location(std::cerr, function, path, line);
+ std::cerr << " : did not raise exception\n";
+
+}
+
+inline void check_raises_raised_unexpected(const char* function, const char* path, unsigned line)
+{
+ s_num_failures++;
+ std::cerr << "FAILURE at ";
+ print_location(std::cerr, function, path, line);
+ std::cerr << " : unexpected exception raised\n";
+}
#define ASSERT_EQ(x, y) do { check_equal((x), (y), __func__, __FILE__, __LINE__); } \
while (false)
#define ASSERT_TRUE(x) do { check_true(bool(x), __func__, __FILE__, __LINE__); } \
while (false)
-#define ASSERT_FALSE(x) do { !check_true(bool(x), __func__, __FILE__, __LINE__); } \
+#define ASSERT_FALSE(x) do { check_true(!bool(x), __func__, __FILE__, __LINE__); } \
while (false)
+#define ASSERT_RAISES(x, T) \
+ do { try { \
+ x; \
+ check_raises_did_not_raise(__func__, __FILE__, __LINE__); \
+ } catch (const T&) { \
+ check_raises_success(__func__, __FILE__, __LINE__); \
+ } catch (...) { \
+ check_raises_raised_unexpected(__func__, __FILE__, __LINE__); \
+ } } while (false)
+
int finish_tests();
#endif