From 81b9f9b16b9a2d5e6269ceb69415ea692583f11f Mon Sep 17 00:00:00 2001 From: Kirill Kornyakov Date: Mon, 11 Feb 2013 14:58:38 +0400 Subject: [PATCH] Added a test that documents that negative numbers are not clipped by cv::saturate_cast --- modules/core/test/test_misc.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/core/test/test_misc.cpp b/modules/core/test/test_misc.cpp index 5515ebff2..5af419c93 100644 --- a/modules/core/test/test_misc.cpp +++ b/modules/core/test/test_misc.cpp @@ -39,4 +39,12 @@ TEST(Core_OutputArraySreate, _1997) Size submatSize = Size(256, 256); ASSERT_NO_THROW(local::create( mat(Rect(Point(), submatSize)), submatSize, mat.type() )); -} \ No newline at end of file +} + +TEST(Core_SaturateCast, NegativeNotClipped) +{ + double d = -1.0; + unsigned int val = cv::saturate_cast(d); + + ASSERT_EQ(0xffffffff, val); +}