core: add a test of iteration through the Mat_ with range-based for

pull/9032/head
Vladislav Sovrasov 8 years ago
parent 267fdc4c91
commit f42b7d03b4
  1. 18
      modules/core/test/test_mat.cpp

@ -1734,3 +1734,21 @@ TEST(Mat, regression_8680)
mat.release();
ASSERT_EQ(mat.channels(), 2);
}
#ifdef CV_CXX_11
TEST(Mat_, range_based_for)
{
Mat_<uchar> img = Mat_<uchar>::zeros(3, 3);
for(auto& pixel : img)
{
pixel = 1;
}
Mat_<uchar> ref(3, 3);
ref.setTo(Scalar(1));
ASSERT_DOUBLE_EQ(norm(img, ref), 0.);
}
#endif

Loading…
Cancel
Save