added UMat::setTo accuracy test

This commit is contained in:
Ilya Lavrenov 2014-04-09 14:15:22 +04:00
parent 96484e1ad7
commit bcd7151867

View File

@ -107,6 +107,7 @@ PARAM_TEST_CASE(CopyTo, MatDepth, Channels, bool, bool)
{
int depth, cn;
bool use_roi, use_mask;
Scalar val;
TEST_DECLARE_INPUT_PARAMETER(src);
TEST_DECLARE_INPUT_PARAMETER(mask);
@ -143,6 +144,8 @@ PARAM_TEST_CASE(CopyTo, MatDepth, Channels, bool, bool)
if (use_mask)
UMAT_UPLOAD_INPUT_PARAMETER(mask);
UMAT_UPLOAD_OUTPUT_PARAMETER(dst);
val = randomScalar(-MAX_VALUE, MAX_VALUE);
}
};
@ -168,12 +171,38 @@ OCL_TEST_P(CopyTo, Accuracy)
}
}
typedef CopyTo SetTo;
OCL_TEST_P(SetTo, Accuracy)
{
for (int j = 0; j < test_loop_times; j++)
{
generateTestData();
if (use_mask)
{
OCL_OFF(dst_roi.setTo(val, mask_roi));
OCL_ON(udst_roi.setTo(val, umask_roi));
}
else
{
OCL_OFF(dst_roi.setTo(val));
OCL_ON(udst_roi.setTo(val));
}
OCL_EXPECT_MATS_NEAR(dst, 0);
}
}
OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, ConvertTo, Combine(
OCL_ALL_DEPTHS, OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, Bool()));
OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, CopyTo, Combine(
OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, Bool(), Bool()));
OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, SetTo, Combine(
OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, Bool(), Bool()));
} } // namespace cvtest::ocl
#endif