Skip to content

Commit

Permalink
core: add a test of iteration through the Mat_ with range-based for
Browse files Browse the repository at this point in the history
  • Loading branch information
sovrasov committed Jul 3, 2017
1 parent 267fdc4 commit f42b7d0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/core/test/test_mat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f42b7d0

Please sign in to comment.