Added a test that documents that negative numbers are not clipped by cv::saturate_cast

This commit is contained in:
Kirill Kornyakov
2013-02-11 14:58:38 +04:00
parent 716e0192b3
commit 81b9f9b16b

View File

@@ -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);
}