34 const T&
ref,
const U& val,
double atol = 1e-8,
double rtol = 1e-5) {
35 boost::test_tools::predicate_result res(
true);
37 if (
ref->getWidth() != val->getWidth() ||
ref->getHeight() != val->getHeight()) {
39 res.message() <<
"Images do not match in size: "
40 <<
ref->getWidth() <<
'x' <<
ref->getHeight() <<
" vs "
41 << val->getWidth() <<
'x' << val->getHeight();
44 int w =
ref->getWidth(), h =
ref->getHeight();
45 auto ref_chunk =
ref->getChunk(0, 0, w, h);
46 auto val_chunk = val->getChunk(0, 0, w, h);
48 for (
int x = 0;
x <
ref->getWidth(); ++
x) {
49 for (
int y = 0;
y <
ref->getHeight(); ++
y) {
50 auto expected = ref_chunk->getValue(
x,
y);
51 auto value = val_chunk->getValue(
x,
y);
54 res.message() <<
"Not matching values at position " <<
x <<
"," <<
y
55 <<
": " << expected <<
" != " << value <<
"\n";