mirror of
https://github.com/opencv/opencv.git
synced 2024-11-30 06:10:02 +08:00
core(test): zero values divide test (4.0+)
This commit is contained in:
parent
4a9291fd89
commit
09cb329d73
@ -2286,6 +2286,7 @@ template <typename T> static inline
|
||||
void testDivideChecks(const Mat& dst)
|
||||
{
|
||||
ASSERT_FALSE(dst.empty());
|
||||
CV_StaticAssert(std::numeric_limits<T>::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 <typename T> static inline
|
||||
void testDivideChecksFP(const Mat& dst)
|
||||
{
|
||||
ASSERT_FALSE(dst.empty());
|
||||
CV_StaticAssert(!std::numeric_limits<T>::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<T>(y, x))) << "dst(" << y << ", " << x << ") = " << dst.at<T>(y, x);
|
||||
}
|
||||
else if (x == 2)
|
||||
{
|
||||
EXPECT_TRUE(cvIsInf(dst.at<T>(y, x))) << "dst(" << y << ", " << x << ") = " << dst.at<T>(y, x);
|
||||
}
|
||||
else
|
||||
{
|
||||
EXPECT_FALSE(cvIsNaN(dst.at<T>(y, x))) << "dst(" << y << ", " << x << ") = " << dst.at<T>(y, x);
|
||||
EXPECT_FALSE(cvIsInf(dst.at<T>(y, x))) << "dst(" << y << ", " << x << ") = " << dst.at<T>(y, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <> inline void testDivideChecks<float>(const Mat& dst) { testDivideChecksFP<float>(dst); }
|
||||
template <> inline void testDivideChecks<double>(const Mat& dst) { testDivideChecksFP<double>(dst); }
|
||||
|
||||
|
||||
template <typename T, bool isUMat> static inline
|
||||
void testDivide()
|
||||
|
Loading…
Reference in New Issue
Block a user