Added a test that documents that negative numbers are not clipped by cv::saturate_cast
This commit is contained in:
@@ -39,4 +39,12 @@ TEST(Core_OutputArraySreate, _1997)
|
|||||||
Size submatSize = Size(256, 256);
|
Size submatSize = Size(256, 256);
|
||||||
|
|
||||||
ASSERT_NO_THROW(local::create( mat(Rect(Point(), submatSize)), submatSize, mat.type() ));
|
ASSERT_NO_THROW(local::create( mat(Rect(Point(), submatSize)), submatSize, mat.type() ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Core_SaturateCast, NegativeNotClipped)
|
||||||
|
{
|
||||||
|
double d = -1.0;
|
||||||
|
unsigned int val = cv::saturate_cast<unsigned int>(d);
|
||||||
|
|
||||||
|
ASSERT_EQ(0xffffffff, val);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user