test: fix tolerance

cv::rand result is not bitexact for floating-point numbers
This commit is contained in:
Alexander Alekhin 2016-10-18 16:58:20 +03:00
parent abad2ca76c
commit 5bafc1db75

View File

@ -22,16 +22,19 @@ PERF_TEST_P( Size_SrcDepth_DstChannels, merge,
int srcDepth = get<1>(GetParam());
int dstChannels = get<2>(GetParam());
int maxValue = 255;
vector<Mat> mv;
for( int i = 0; i < dstChannels; ++i )
{
mv.push_back( Mat(sz, CV_MAKETYPE(srcDepth, 1)) );
randu(mv[i], 0, 255);
randu(mv[i], 0, maxValue);
}
Mat dst;
int runs = (sz.width <= 640) ? 8 : 1;
TEST_CYCLE_MULTIRUN(runs) merge( (vector<Mat> &)mv, dst );
SANITY_CHECK(dst, 1e-12);
double eps = srcDepth <= CV_32S ? 1e-12 : (FLT_EPSILON * maxValue);
SANITY_CHECK(dst, eps);
}