summaryrefslogtreecommitdiff
path: root/test/libapt/assert.h
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-05-21 11:29:05 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2012-05-21 11:29:05 +0200
commit6c1f5d2c3c8df164e78dda8f24d28667634403e1 (patch)
treed711a52cf5a92a13b87f248307f5521846a7dbcf /test/libapt/assert.h
parentaa2218b25cb29e8c0677f0f3ede098583c7ae49f (diff)
parent0baf849d81814fce59d86eecccbe624c8aaf0456 (diff)
merged from David, uncommited the previous i18n commit first as its part of the merge from David already but for some reason bzr is confused and gives a gazillion of conflicts in doc/po/de.po without the uncommit first
Diffstat (limited to 'test/libapt/assert.h')
-rw-r--r--test/libapt/assert.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/libapt/assert.h b/test/libapt/assert.h
index a07be4b57..fdf6740c6 100644
--- a/test/libapt/assert.h
+++ b/test/libapt/assert.h
@@ -1,6 +1,7 @@
#include <iostream>
#define equals(x,y) assertEquals(y, x, __LINE__)
+#define equalsNot(x,y) assertEqualsNot(y, x, __LINE__)
template < typename X, typename Y >
void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) {
@@ -14,6 +15,13 @@ void assertEquals(X expect, Y get, unsigned long const &line) {
OutputAssertEqual(expect, "==", get, line);
}
+template < typename X, typename Y >
+void assertEqualsNot(X expect, Y get, unsigned long const &line) {
+ if (expect != get)
+ return;
+ OutputAssertEqual(expect, "!=", get, line);
+}
+
void assertEquals(unsigned int const &expect, int const &get, unsigned long const &line) {
if (get < 0)
OutputAssertEqual(expect, "==", get, line);
@@ -80,6 +88,19 @@ void assertEqualsOr3(X expect1, X expect2, X expect3, Y get, unsigned long const
OutputAssertEqualOr3(expect1, expect2, expect3, "==", get, line);
}
+#define equalsOr4(v,w,x,y,z) assertEqualsOr4(w, x, y, z, v, __LINE__)
+
+template < typename X, typename Y >
+void OutputAssertEqualOr4(X expect1, X expect2, X expect3, X expect4, char const* compare, Y get, unsigned long const &line) {
+ std::cerr << "Test FAILED: »" << expect1 << "« or »" << expect2 << "« or »" << expect3 << "« or »" << expect4 << "« " << compare << " »" << get << "« at line " << line << std::endl;
+}
+
+template < typename X, typename Y >
+void assertEqualsOr4(X expect1, X expect2, X expect3, X expect4, Y get, unsigned long const &line) {
+ if (expect1 == get || expect2 == get || expect3 == get || expect4 == get)
+ return;
+ OutputAssertEqualOr4(expect1, expect2, expect3, expect4, "==", get, line);
+}
// simple helper to quickly output a vectors
template < typename X >