From f7f0d6c7560a8f71707e7852a512469147aa9f84 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 11 Aug 2011 20:53:28 +0200 Subject: cppcheck complains about some possible speed improvements which could be done on the mirco-optimazation level, so lets fix them: (performance) Possible inefficient checking for emptiness. (performance) Prefer prefix ++/-- operators for non-primitive types. --- test/libapt/assert.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/libapt/assert.h') diff --git a/test/libapt/assert.h b/test/libapt/assert.h index 92b662dfa..fae9b6c64 100644 --- a/test/libapt/assert.h +++ b/test/libapt/assert.h @@ -53,3 +53,11 @@ void assertEqualsOr2(int const &expect1, int const &expect2, unsigned int const assertEqualsOr2(expect1, expect2, get, line); } + +// simple helper to quickly output a vectors +template < typename X > +void dumpVector(X vec) { + for (typename X::const_iterator v = vec.begin(); + v != vec.end(); ++v) + std::cout << *v << std::endl; +} -- cgit v1.2.3 From 7cb28948317e0d326c8663ec3c9ce995d5bf65e8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Oct 2011 22:45:22 +0200 Subject: * apt-pkg/deb/debmetaindex.cc: - none is a separator, not a language: no need for Index (Closes: #624218) * apt-pkg/aptconfiguration.cc: - do not builtin languages only if none is forced (Closes: #643787) --- test/libapt/assert.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/libapt/assert.h') diff --git a/test/libapt/assert.h b/test/libapt/assert.h index fae9b6c64..ce5accc1c 100644 --- a/test/libapt/assert.h +++ b/test/libapt/assert.h @@ -54,6 +54,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) { -- cgit v1.2.3 From fa4d3cdc8a60e71fd3fef1c2a2cda6f80377445b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 11 Oct 2011 13:05:40 +0200 Subject: fix compiler warning about signed comparision on amd64, too --- test/libapt/assert.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/libapt/assert.h') diff --git a/test/libapt/assert.h b/test/libapt/assert.h index ce5accc1c..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(expect, get, line); } +void assertEquals(unsigned long const &expect, int const &get, unsigned long const &line) { + if (get < 0) + OutputAssertEqual(expect, "==", get, line); + assertEquals(expect, get, line); +} + +void assertEquals(int const &expect, unsigned long const &get, unsigned long const &line) { + if (expect < 0) + OutputAssertEqual(expect, "==", get, line); + assertEquals(expect, get, line); +} + #define equalsOr2(x,y,z) assertEqualsOr2(y, z, x, __LINE__) -- cgit v1.2.3