From b496888597a6bcc0617ca78dba55da7edcaaac06 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 5 Jan 2016 21:12:43 +0000 Subject: Test with a class that has suitable semantics instead of a POD type --- libadhocutil/unittests/testCache.cpp | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/libadhocutil/unittests/testCache.cpp b/libadhocutil/unittests/testCache.cpp index 6520aa3..650e3c7 100644 --- a/libadhocutil/unittests/testCache.cpp +++ b/libadhocutil/unittests/testCache.cpp @@ -9,12 +9,34 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE(std::nullptr_t); // LCOV_EXCL_STOP +class Obj { + public: + Obj(int i) : v(i) { } + bool operator==(const int & i) const { + return v == i; + } + int v; +}; + +bool +operator==(const int & i, const Obj & o) +{ + return i == o.v; +} + +namespace std { + ostream & operator<<(ostream & s, const Obj & o) + { + return s << o.v; + } +} + namespace AdHoc { - typedef Cache TestCache; - template class Cache; - template class Cacheable; - template class ObjectCacheable; - template class CallCacheable; + typedef Cache TestCache; + template class Cache; + template class Cacheable; + template class ObjectCacheable; + template class CallCacheable; } using namespace AdHoc; -- cgit v1.2.3