summaryrefslogtreecommitdiff
path: root/test/libapt/assert.h
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:56:21 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:56:21 +0100
commit7cb543fb742a837c4931513674febaec5e4c1401 (patch)
treeddefe5b9329907818aa6eb3b593f555b29ccb869 /test/libapt/assert.h
parentf6cb0880a4b5d31e398cceb2e2577b6b82f4fffb (diff)
parent71ecaad29d8066a494f516efc5efd80860653fe2 (diff)
merged from lp:~mvo/apt/mvo (that has all the changes from debian-experimental2) and resolved a bunch of conflicts
Diffstat (limited to 'test/libapt/assert.h')
-rw-r--r--test/libapt/assert.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/libapt/assert.h b/test/libapt/assert.h
index fae9b6c64..a07be4b57 100644
--- a/test/libapt/assert.h
+++ b/test/libapt/assert.h
@@ -26,6 +26,18 @@ void assertEquals(int const &expect, unsigned int const &get, unsigned long cons
assertEquals<unsigned int const&, unsigned int const&>(expect, get, line);
}
+void assertEquals(unsigned long const &expect, int const &get, unsigned long const &line) {
+ if (get < 0)
+ OutputAssertEqual(expect, "==", get, line);
+ assertEquals<unsigned long const&, unsigned long const&>(expect, get, line);
+}
+
+void assertEquals(int const &expect, unsigned long const &get, unsigned long const &line) {
+ if (expect < 0)
+ OutputAssertEqual(expect, "==", get, line);
+ assertEquals<unsigned long const&, unsigned long const&>(expect, get, line);
+}
+
#define equalsOr2(x,y,z) assertEqualsOr2(y, z, x, __LINE__)
@@ -54,6 +66,21 @@ void assertEqualsOr2(int const &expect1, int const &expect2, unsigned int const
}
+#define equalsOr3(w,x,y,z) assertEqualsOr3(x, y, z, w, __LINE__)
+
+template < typename X, typename Y >
+void OutputAssertEqualOr3(X expect1, X expect2, X expect3, char const* compare, Y get, unsigned long const &line) {
+ std::cerr << "Test FAILED: »" << expect1 << "« or »" << expect2 << "« or »" << expect3 << "« " << compare << " »" << get << "« at line " << line << std::endl;
+}
+
+template < typename X, typename Y >
+void assertEqualsOr3(X expect1, X expect2, X expect3, Y get, unsigned long const &line) {
+ if (expect1 == get || expect2 == get || expect3 == get)
+ return;
+ OutputAssertEqualOr3(expect1, expect2, expect3, "==", get, line);
+}
+
+
// simple helper to quickly output a vectors
template < typename X >
void dumpVector(X vec) {