]> git.saurik.com Git - apt.git/blame - test/libapt/assert.h
merged from lp:~donkult/apt/sid
[apt.git] / test / libapt / assert.h
CommitLineData
cefb7c1f
DK
1#include <iostream>
2
3#define equals(x,y) assertEquals(x, y, __LINE__)
4
5template < typename X, typename Y >
6void 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
10template < typename X, typename Y >
11void assertEquals(X expect, Y get, unsigned long const &line) {
12 if (expect == get)
13 return;
14 OutputAssert(expect, "==", get, line);
15}
16
17void 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}