opencv/modules/core/test/test_misc.cpp

29 lines
694 B
C++
Raw Normal View History

2012-10-17 07:18:30 +08:00
#include "test_precomp.hpp"
using namespace cv;
using namespace std;
2013-12-27 20:33:18 +08:00
TEST(Core_OutputArrayCreate, _1997)
2012-10-17 07:18:30 +08:00
{
struct local {
static void create(OutputArray arr, Size submatSize, int type)
{
int sizes[] = {submatSize.width, submatSize.height};
arr.create(sizeof(sizes)/sizeof(sizes[0]), sizes, type);
}
};
Mat mat(Size(512, 512), CV_8U);
Size submatSize = Size(256, 256);
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);
}