Added variation on boost::optional assert_equal to allow for const refs

release/4.3a0
Alex Cunningham 2012-02-28 03:51:24 +00:00
parent 25f1f25062
commit c2947ea633
1 changed files with 8 additions and 0 deletions

View File

@ -70,6 +70,14 @@ bool assert_equal(const V& expected, const boost::optional<V>& actual, double to
return assert_equal(expected, *actual, tol); return assert_equal(expected, *actual, tol);
} }
template<class V>
bool assert_equal(const V& expected, const boost::optional<const V&>& actual, double tol = 1e-9) {
if (!actual) {
std::cout << "actual is boost::none" << std::endl;
return false;
}
return assert_equal(expected, *actual, tol);
}
/** /**
* Version of assert_equals to work with vectors * Version of assert_equals to work with vectors