]> git.saurik.com Git - apt.git/blob - test/libapt/assert.h
create the partial dirs also automatic if only Dir::Cache::archives or
[apt.git] / test / libapt / assert.h
1 #include <iostream>
2
3 #define equals(x,y) assertEquals(x, y, __LINE__)
4
5 template < typename X, typename Y >
6 void OutputAssert(X expect, char const* compare, Y get, unsigned long const &line) {
7 std::cerr << "Test FAILED: »" << expect << "« " << compare << " »" << get << "« at line " << line << std::endl;
8 }
9
10 template < typename X, typename Y >
11 void assertEquals(X expect, Y get, unsigned long const &line) {
12 if (expect == get)
13 return;
14 OutputAssert(expect, "==", get, line);
15 }
16
17 void assertEquals(unsigned int const &expect, int const &get, unsigned long const &line) {
18 if (get < 0)
19 OutputAssert(expect, "==", get, line);
20 assertEquals<unsigned int const&, unsigned int const&>(expect, get, line);
21 }