diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 96d5f429d0..b9a7d78d21 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -2286,6 +2286,7 @@ template static inline void testDivideChecks(const Mat& dst) { ASSERT_FALSE(dst.empty()); + CV_StaticAssert(std::numeric_limits::is_integer, ""); for (int y = 0; y < dst.rows; y++) { for (int x = 0; x < dst.cols; x++) @@ -2298,6 +2299,35 @@ void testDivideChecks(const Mat& dst) } } +template static inline +void testDivideChecksFP(const Mat& dst) +{ + ASSERT_FALSE(dst.empty()); + CV_StaticAssert(!std::numeric_limits::is_integer, ""); + for (int y = 0; y < dst.rows; y++) + { + for (int x = 0; x < dst.cols; x++) + { + if (y == 0 && x == 2) + { + EXPECT_TRUE(cvIsNaN(dst.at(y, x))) << "dst(" << y << ", " << x << ") = " << dst.at(y, x); + } + else if (x == 2) + { + EXPECT_TRUE(cvIsInf(dst.at(y, x))) << "dst(" << y << ", " << x << ") = " << dst.at(y, x); + } + else + { + EXPECT_FALSE(cvIsNaN(dst.at(y, x))) << "dst(" << y << ", " << x << ") = " << dst.at(y, x); + EXPECT_FALSE(cvIsInf(dst.at(y, x))) << "dst(" << y << ", " << x << ") = " << dst.at(y, x); + } + } + } +} + +template <> inline void testDivideChecks(const Mat& dst) { testDivideChecksFP(dst); } +template <> inline void testDivideChecks(const Mat& dst) { testDivideChecksFP(dst); } + template static inline void testDivide()