21 #include <type_traits> 24 #include <mia/test/testhelpers.hh> 26 #ifndef mia_template_filtertest_hh 27 #define mia_template_filtertest_hh 38 template <
template <
class>
class Image>
40 typedef typename Image<int>::dimsize_type dimsize_type;
57 template <
typename Filter,
typename IN,
typename OUT>
58 void run(
const dimsize_type& in_size,
const IN *init_data,
59 const dimsize_type& out_size,
const OUT *test_data,
const Filter& f) {
60 Image<IN> image(in_size, init_data);
61 image.set_attribute(
"test_attr", m_attr);
63 auto result = f.filter(image);
66 auto result_attr = result->get_attribute(
"test_attr");
67 BOOST_REQUIRE(result_attr);
68 BOOST_CHECK_EQUAL(*result_attr, *m_attr);
72 auto r =
dynamic_cast<const Image<OUT>&
>(*result);
74 BOOST_CHECK_EQUAL(r.get_size(), out_size);
75 BOOST_REQUIRE(r.get_size()== out_size);
77 const OUT *t = test_data;
78 auto i = r.begin_range(dimsize_type::_0, out_size);
79 auto e = r.end_range(dimsize_type::_0, out_size);
82 cvfail() << i.pos() <<
"\n";
83 miatest::equal_or_close(*i, *t);
a Fixture to do general plug.in testing
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
std::shared_ptr< CAttribute > PAttribute
define the shared pointer wrapped attribute pointer
vstream & cvfail()
direct output to this stream adapter to print out failtures in tests beyond BOOST_FAIL ...
void run(const dimsize_type &in_size, const IN *init_data, const dimsize_type &out_size, const OUT *test_data, const Filter &f)
Class of an attribute that holds data of type T.
#define NS_MIA_END
conveniance define to end the mia namespace