Commit 56745b54 authored by Alexey Spizhevoy's avatar Alexey Spizhevoy

refactored gpu tests a little

parent c104cdce
...@@ -679,9 +679,14 @@ struct CV_GpuMinMaxTest: public CvTest ...@@ -679,9 +679,14 @@ struct CV_GpuMinMaxTest: public CvTest
cv::gpu::GpuMat buf; cv::gpu::GpuMat buf;
void run(int) void run(int)
{
try
{ {
int depth_end; int depth_end;
if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice())) depth_end = CV_64F; else depth_end = CV_32F; if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice()))
depth_end = CV_64F;
else
depth_end = CV_32F;
for (int depth = CV_8U; depth <= depth_end; ++depth) for (int depth = CV_8U; depth <= depth_end; ++depth)
{ {
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
...@@ -693,6 +698,12 @@ struct CV_GpuMinMaxTest: public CvTest ...@@ -693,6 +698,12 @@ struct CV_GpuMinMaxTest: public CvTest
} }
} }
} }
catch (const Exception& e)
{
if (!check_and_treat_gpu_exception(e, ts)) throw;
return;
}
}
void test(int rows, int cols, int cn, int depth) void test(int rows, int cols, int cn, int depth)
{ {
...@@ -803,9 +814,14 @@ struct CV_GpuMinMaxLocTest: public CvTest ...@@ -803,9 +814,14 @@ struct CV_GpuMinMaxLocTest: public CvTest
GpuMat valbuf, locbuf; GpuMat valbuf, locbuf;
void run(int) void run(int)
{
try
{ {
int depth_end; int depth_end;
if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice())) depth_end = CV_64F; else depth_end = CV_32F; if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice()))
depth_end = CV_64F;
else
depth_end = CV_32F;
for (int depth = CV_8U; depth <= depth_end; ++depth) for (int depth = CV_8U; depth <= depth_end; ++depth)
{ {
int rows = 1, cols = 3; int rows = 1, cols = 3;
...@@ -818,6 +834,12 @@ struct CV_GpuMinMaxLocTest: public CvTest ...@@ -818,6 +834,12 @@ struct CV_GpuMinMaxLocTest: public CvTest
} }
} }
} }
catch (const Exception& e)
{
if (!check_and_treat_gpu_exception(e, ts)) throw;
return;
}
}
void test(int rows, int cols, int depth) void test(int rows, int cols, int depth)
{ {
...@@ -875,9 +897,13 @@ struct CV_GpuCountNonZeroTest: CvTest ...@@ -875,9 +897,13 @@ struct CV_GpuCountNonZeroTest: CvTest
void run(int) void run(int)
{ {
srand(0); try
{
int depth_end; int depth_end;
if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice())) depth_end = CV_64F; else depth_end = CV_32F; if (cv::gpu::hasNativeDoubleSupport(cv::gpu::getDevice()))
depth_end = CV_64F;
else
depth_end = CV_32F;
for (int depth = CV_8U; depth <= CV_32F; ++depth) for (int depth = CV_8U; depth <= CV_32F; ++depth)
{ {
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
...@@ -888,6 +914,12 @@ struct CV_GpuCountNonZeroTest: CvTest ...@@ -888,6 +914,12 @@ struct CV_GpuCountNonZeroTest: CvTest
} }
} }
} }
catch (const Exception& e)
{
if (!check_and_treat_gpu_exception(e, ts)) throw;
return;
}
}
void test(int rows, int cols, int depth) void test(int rows, int cols, int depth)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment