minor gpu tests fix
This commit is contained in:
parent
a0aef244d6
commit
ec7f9566e0
@ -71,9 +71,9 @@ void printCudaInfo()
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
CommandLineParser cmd(argc, argv,
|
||||
CommandLineParser cmd(argc, (const char**) argv,
|
||||
"{ print_info_only | print_info_only | false | Print information about system and exit }"
|
||||
"{ device | device | 0 | Device on which tests will be executed }"
|
||||
"{ cpu | cpu | false | Run tests on cpu }"
|
||||
@ -119,7 +119,7 @@ int main(int argc, char **argv)
|
||||
cout << "Run tests on device " << device << " [" << info.name() << "] \n" << endl;
|
||||
}
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
InitGoogleTest(&argc, argv);
|
||||
perf::TestBase::Init(argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
@ -49,93 +49,103 @@ using namespace cv::gpu;
|
||||
using namespace cvtest;
|
||||
using namespace testing;
|
||||
|
||||
void printInfo()
|
||||
void printOsInfo()
|
||||
{
|
||||
#if defined _WIN32
|
||||
# if defined _WIN64
|
||||
puts("OS: Windows x64");
|
||||
cout << "OS: Windows x64 \n" << endl;
|
||||
# else
|
||||
puts("OS: Windows x32");
|
||||
cout << "OS: Windows x32 \n" << endl;
|
||||
# endif
|
||||
#elif defined linux
|
||||
# if defined _LP64
|
||||
puts("OS: Linux x64");
|
||||
cout << "OS: Linux x64 \n" << endl;
|
||||
# else
|
||||
puts("OS: Linux x32");
|
||||
cout << "OS: Linux x32 \n" << endl;
|
||||
# endif
|
||||
#elif defined __APPLE__
|
||||
# if defined _LP64
|
||||
puts("OS: Apple x64");
|
||||
cout << "OS: Apple x64 \n" << endl;
|
||||
# else
|
||||
puts("OS: Apple x32");
|
||||
cout << "OS: Apple x32 \n" << endl;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void printCudaInfo()
|
||||
{
|
||||
#ifndef HAVE_CUDA
|
||||
cout << "OpenCV was built without CUDA support \n" << endl;
|
||||
#else
|
||||
int driver;
|
||||
cudaDriverGetVersion(&driver);
|
||||
|
||||
printf("CUDA Driver version: %d\n", driver);
|
||||
printf("CUDA Runtime version: %d\n", CUDART_VERSION);
|
||||
cout << "CUDA Driver version: " << driver << '\n';
|
||||
cout << "CUDA Runtime version: " << CUDART_VERSION << '\n';
|
||||
|
||||
puts("GPU module was compiled for the following GPU archs:");
|
||||
printf(" BIN: %s\n", CUDA_ARCH_BIN);
|
||||
printf(" PTX: %s\n\n", CUDA_ARCH_PTX);
|
||||
cout << endl;
|
||||
|
||||
cout << "GPU module was compiled for the following GPU archs:" << endl;
|
||||
cout << " BIN: " << CUDA_ARCH_BIN << '\n';
|
||||
cout << " PTX: " << CUDA_ARCH_PTX << '\n';
|
||||
|
||||
cout << endl;
|
||||
|
||||
int deviceCount = getCudaEnabledDeviceCount();
|
||||
printf("CUDA device count: %d\n\n", deviceCount);
|
||||
cout << "CUDA device count: " << deviceCount << '\n';
|
||||
|
||||
cout << endl;
|
||||
|
||||
for (int i = 0; i < deviceCount; ++i)
|
||||
{
|
||||
DeviceInfo info(i);
|
||||
|
||||
printf("Device %d:\n", i);
|
||||
printf(" Name: %s\n", info.name().c_str());
|
||||
printf(" Compute capability version: %d.%d\n", info.majorVersion(), info.minorVersion());
|
||||
printf(" Multi Processor Count: %d\n", info.multiProcessorCount());
|
||||
printf(" Total memory: %d Mb\n", static_cast<int>(static_cast<int>(info.totalMemory() / 1024.0) / 1024.0));
|
||||
printf(" Free memory: %d Mb\n", static_cast<int>(static_cast<int>(info.freeMemory() / 1024.0) / 1024.0));
|
||||
cout << "Device [" << i << "] \n";
|
||||
cout << "\t Name: " << info.name() << '\n';
|
||||
cout << "\t Compute capability: " << info.majorVersion() << '.' << info.minorVersion()<< '\n';
|
||||
cout << "\t Multi Processor Count: " << info.multiProcessorCount() << '\n';
|
||||
cout << "\t Total memory: " << static_cast<int>(static_cast<int>(info.totalMemory() / 1024.0) / 1024.0) << " Mb \n";
|
||||
cout << "\t Free memory: " << static_cast<int>(static_cast<int>(info.freeMemory() / 1024.0) / 1024.0) << " Mb \n";
|
||||
if (!info.isCompatible())
|
||||
puts(" !!! This device is NOT compatible with current GPU module build\n");
|
||||
printf("\n");
|
||||
cout << "\t !!! This device is NOT compatible with current GPU module build \n";
|
||||
|
||||
cout << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
enum OutputLevel
|
||||
{
|
||||
OutputLevelNone,
|
||||
OutputLevelCompact,
|
||||
OutputLevelFull
|
||||
};
|
||||
|
||||
extern OutputLevel nvidiaTestOutputLevel;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try
|
||||
{
|
||||
CommandLineParser parser(argc, (const char**)argv,
|
||||
"{ print_info_only | print_info_only | false | Print information about system and exit }"
|
||||
"{ device | device | -1 | Device on which tests will be executed (-1 means all devices) }"
|
||||
"{ nvtest_output_level | nvtest_output_level | compact | NVidia test verbosity level }");
|
||||
CommandLineParser cmd(argc, (const char**)argv,
|
||||
"{ print_info_only | print_info_only | false | Print information about system and exit }"
|
||||
"{ device | device | -1 | Device on which tests will be executed (-1 means all devices) }"
|
||||
"{ nvtest_output_level | nvtest_output_level | compact | NVidia test verbosity level }"
|
||||
);
|
||||
|
||||
printInfo();
|
||||
printOsInfo();
|
||||
printCudaInfo();
|
||||
|
||||
if (parser.get<bool>("print_info_only"))
|
||||
if (cmd.get<bool>("print_info_only"))
|
||||
return 0;
|
||||
|
||||
int device = parser.get<int>("device");
|
||||
int device = cmd.get<int>("device");
|
||||
if (device < 0)
|
||||
{
|
||||
DeviceManager::instance().loadAll();
|
||||
std::cout << "Run tests on all supported devices\n" << std::endl;
|
||||
|
||||
cout << "Run tests on all supported devices \n" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
DeviceManager::instance().load(device);
|
||||
std::cout << "Run tests on device " << device << '\n' << std::endl;
|
||||
|
||||
DeviceInfo info(device);
|
||||
cout << "Run tests on device " << device << " [" << info.name() << "] \n" << endl;
|
||||
}
|
||||
|
||||
string outputLevel = parser.get<string>("nvtest_output_level");
|
||||
string outputLevel = cmd.get<string>("nvtest_output_level");
|
||||
|
||||
if (outputLevel == "none")
|
||||
nvidiaTestOutputLevel = OutputLevelNone;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef __main_test_nvidia_h__
|
||||
#define __main_test_nvidia_h__
|
||||
|
||||
#include<string>
|
||||
#include <string>
|
||||
|
||||
enum OutputLevel
|
||||
{
|
||||
@ -10,6 +10,8 @@ enum OutputLevel
|
||||
OutputLevelFull
|
||||
};
|
||||
|
||||
extern OutputLevel nvidiaTestOutputLevel;
|
||||
|
||||
bool nvidia_NPPST_Integral_Image(const std::string& test_data_path, OutputLevel outputLevel);
|
||||
bool nvidia_NPPST_Squared_Integral_Image(const std::string& test_data_path, OutputLevel outputLevel);
|
||||
bool nvidia_NPPST_RectStdDev(const std::string& test_data_path, OutputLevel outputLevel);
|
||||
|
@ -39,7 +39,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
namespace {
|
||||
|
||||
@ -329,7 +331,7 @@ TEST_P(ReprojectImageTo3D, Accuracy)
|
||||
|
||||
cv::gpu::GpuMat dst;
|
||||
cv::gpu::reprojectImageTo3D(loadMat(disp, useRoi), dst, Q, 3);
|
||||
|
||||
|
||||
cv::Mat dst_gold;
|
||||
cv::reprojectImageTo3D(disp, dst_gold, Q, false);
|
||||
|
||||
@ -343,3 +345,5 @@ INSTANTIATE_TEST_CASE_P(GPU_Calib3D, ReprojectImageTo3D, testing::Combine(
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
@ -39,7 +39,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
namespace {
|
||||
|
||||
@ -98,3 +100,5 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, CopyMakeBorder, testing::Combine(
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -39,7 +39,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
namespace {
|
||||
|
||||
@ -3396,3 +3398,5 @@ INSTANTIATE_TEST_CASE_P(GPU_Core, Reduce, testing::Combine(
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -39,7 +39,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
namespace {
|
||||
|
||||
@ -984,3 +986,5 @@ INSTANTIATE_TEST_CASE_P(GPU_Features2D, BruteForceMatcher, testing::Combine(
|
||||
testing::Values(UseMask(false), UseMask(true))));
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -39,7 +39,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
namespace {
|
||||
|
||||
@ -552,3 +554,5 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Filter2D, testing::Combine(
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -39,11 +39,11 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
using namespace cv;
|
||||
|
||||
struct CompactPoints : testing::TestWithParam<gpu::DeviceInfo>
|
||||
@ -85,3 +85,5 @@ TEST_P(CompactPoints, CanCompactizeSmallInput)
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_GlobalMotion, CompactPoints, ALL_DEVICES);
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -40,7 +40,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
namespace {
|
||||
|
||||
@ -323,3 +325,5 @@ INSTANTIATE_TEST_CASE_P(GPU_GpuMat, ConvertTo, testing::Combine(
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -39,7 +39,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
namespace {
|
||||
|
||||
@ -1186,3 +1188,5 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, HoughLines, testing::Combine(
|
||||
std::string("../cv/shared/pic6.png"))));
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -39,9 +39,7 @@
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
@ -199,4 +197,4 @@ TEST_P(Labeling, ConnectedComponents)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ConnectedComponents, Labeling, ALL_DEVICES);
|
||||
|
||||
#endif
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -39,21 +39,15 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include <main_test_nvidia.h>
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
OutputLevel nvidiaTestOutputLevel = OutputLevelCompact;
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
using namespace cvtest;
|
||||
using namespace testing;
|
||||
|
||||
//enum OutputLevel
|
||||
//{
|
||||
// OutputLevelNone,
|
||||
// OutputLevelCompact,
|
||||
// OutputLevelFull
|
||||
//};
|
||||
|
||||
struct NVidiaTest : TestWithParam<cv::gpu::DeviceInfo>
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
@ -73,8 +67,6 @@ struct NVidiaTest : TestWithParam<cv::gpu::DeviceInfo>
|
||||
struct NPPST : NVidiaTest {};
|
||||
struct NCV : NVidiaTest {};
|
||||
|
||||
OutputLevel nvidiaTestOutputLevel = OutputLevelCompact;
|
||||
|
||||
//TEST_P(NPPST, Integral)
|
||||
//{
|
||||
// bool res = nvidia_NPPST_Integral_Image(path, nvidiaTestOutputLevel);
|
||||
|
@ -39,8 +39,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include <string>
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
namespace {
|
||||
|
||||
@ -302,13 +303,13 @@ PARAM_TEST_CASE(LBP_Read_classifier, cv::gpu::DeviceInfo, int)
|
||||
|
||||
TEST_P(LBP_Read_classifier, Accuracy)
|
||||
{
|
||||
cv::gpu::CascadeClassifier_GPU classifier;
|
||||
cv::gpu::CascadeClassifier_GPU classifier;
|
||||
std::string classifierXmlPath = std::string(cvtest::TS::ptr()->get_data_path()) + "lbpcascade/lbpcascade_frontalface.xml";
|
||||
ASSERT_TRUE(classifier.load(classifierXmlPath));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ObjDetect, LBP_Read_classifier,
|
||||
testing::Combine(ALL_DEVICES, testing::Values<int>(0)));
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ObjDetect, LBP_Read_classifier,
|
||||
testing::Combine(ALL_DEVICES, testing::Values<int>(0)));
|
||||
|
||||
|
||||
PARAM_TEST_CASE(LBP_classify, cv::gpu::DeviceInfo, int)
|
||||
@ -344,7 +345,7 @@ TEST_P(LBP_classify, Accuracy)
|
||||
for (; it != rects.end(); ++it)
|
||||
cv::rectangle(markedImage, *it, CV_RGB(0, 0, 255));
|
||||
|
||||
cv::gpu::CascadeClassifier_GPU gpuClassifier;
|
||||
cv::gpu::CascadeClassifier_GPU gpuClassifier;
|
||||
ASSERT_TRUE(gpuClassifier.load(classifierXmlPath));
|
||||
|
||||
cv::gpu::GpuMat gpu_rects;
|
||||
@ -352,23 +353,25 @@ TEST_P(LBP_classify, Accuracy)
|
||||
int count = gpuClassifier.detectMultiScale(tested, gpu_rects);
|
||||
|
||||
cv::Mat downloaded(gpu_rects);
|
||||
const cv::Rect* faces = downloaded.ptr<cv::Rect>();
|
||||
const cv::Rect* faces = downloaded.ptr<cv::Rect>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
cv::Rect r = faces[i];
|
||||
|
||||
#if defined (LOG_CASCADE_STATISTIC)
|
||||
std::cout << r.x << " " << r.y << " " << r.width << " " << r.height << std::endl;
|
||||
std::cout << r.x << " " << r.y << " " << r.width << " " << r.height << std::endl;
|
||||
cv::rectangle(markedImage, r , CV_RGB(255, 0, 0));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (LOG_CASCADE_STATISTIC)
|
||||
cv::imshow("Res", markedImage); cv::waitKey();
|
||||
cv::imshow("Res", markedImage); cv::waitKey();
|
||||
#endif
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ObjDetect, LBP_classify,
|
||||
testing::Combine(ALL_DEVICES, testing::Values<int>(0)));
|
||||
testing::Combine(ALL_DEVICES, testing::Values<int>(0)));
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -39,4 +39,4 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include "cvconfig.h"
|
||||
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
@ -72,6 +73,7 @@
|
||||
|
||||
#include "utility.hpp"
|
||||
#include "interpolation.hpp"
|
||||
#include "main_test_nvidia.h"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
#include <cuda.h>
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
@ -39,8 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include <iostream>
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
@ -39,7 +39,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
//#define DUMP
|
||||
|
||||
@ -865,3 +867,5 @@ TEST_P(VideoReader, Regression)
|
||||
INSTANTIATE_TEST_CASE_P(GPU_Video, VideoReader, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi"))));
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
@ -182,105 +182,6 @@ void DeviceManager::loadAll()
|
||||
}
|
||||
}
|
||||
|
||||
class DevicesGenerator : public ParamGeneratorInterface<DeviceInfo>
|
||||
{
|
||||
public:
|
||||
~DevicesGenerator();
|
||||
|
||||
ParamIteratorInterface<DeviceInfo>* Begin() const;
|
||||
ParamIteratorInterface<DeviceInfo>* End() const;
|
||||
|
||||
private:
|
||||
class Iterator : public ParamIteratorInterface<DeviceInfo>
|
||||
{
|
||||
public:
|
||||
Iterator(const ParamGeneratorInterface<DeviceInfo>* base, vector<DeviceInfo>::const_iterator iterator);
|
||||
|
||||
virtual ~Iterator();
|
||||
|
||||
virtual const ParamGeneratorInterface<DeviceInfo>* BaseGenerator() const;
|
||||
|
||||
virtual void Advance();
|
||||
|
||||
virtual ParamIteratorInterface<DeviceInfo>* Clone() const;
|
||||
|
||||
virtual const DeviceInfo* Current() const;
|
||||
|
||||
virtual bool Equals(const ParamIteratorInterface<DeviceInfo>& other) const;
|
||||
|
||||
private:
|
||||
Iterator(const Iterator& other);
|
||||
|
||||
const ParamGeneratorInterface<DeviceInfo>* const base_;
|
||||
vector<DeviceInfo>::const_iterator iterator_;
|
||||
|
||||
mutable DeviceInfo value_;
|
||||
};
|
||||
};
|
||||
|
||||
DevicesGenerator::~DevicesGenerator()
|
||||
{
|
||||
}
|
||||
|
||||
ParamIteratorInterface<DeviceInfo>* DevicesGenerator::Begin() const
|
||||
{
|
||||
return new Iterator(this, DeviceManager::instance().values().begin());
|
||||
}
|
||||
|
||||
ParamIteratorInterface<DeviceInfo>* DevicesGenerator::End() const
|
||||
{
|
||||
return new Iterator(this, DeviceManager::instance().values().end());
|
||||
}
|
||||
|
||||
DevicesGenerator::Iterator::Iterator(const ParamGeneratorInterface<DeviceInfo>* base, vector<DeviceInfo>::const_iterator iterator)
|
||||
: base_(base), iterator_(iterator)
|
||||
{
|
||||
}
|
||||
|
||||
DevicesGenerator::Iterator::~Iterator()
|
||||
{
|
||||
}
|
||||
|
||||
const ParamGeneratorInterface<DeviceInfo>* DevicesGenerator::Iterator::BaseGenerator() const
|
||||
{
|
||||
return base_;
|
||||
}
|
||||
|
||||
void DevicesGenerator::Iterator::Advance()
|
||||
{
|
||||
++iterator_;
|
||||
}
|
||||
|
||||
ParamIteratorInterface<DeviceInfo>* DevicesGenerator::Iterator::Clone() const
|
||||
{
|
||||
return new Iterator(*this);
|
||||
}
|
||||
|
||||
const DeviceInfo* DevicesGenerator::Iterator::Current() const
|
||||
{
|
||||
value_ = *iterator_;
|
||||
return &value_;
|
||||
}
|
||||
|
||||
bool DevicesGenerator::Iterator::Equals(const ParamIteratorInterface<DeviceInfo>& other) const
|
||||
{
|
||||
GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
|
||||
<< "The program attempted to compare iterators "
|
||||
<< "from different generators." << endl;
|
||||
|
||||
return iterator_ == CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
|
||||
}
|
||||
|
||||
DevicesGenerator::Iterator::Iterator(const Iterator& other) :
|
||||
ParamIteratorInterface<DeviceInfo>(), base_(other.base_), iterator_(other.iterator_)
|
||||
{
|
||||
}
|
||||
|
||||
ParamGenerator<DeviceInfo> DevicesGenerator_()
|
||||
{
|
||||
return ParamGenerator<DeviceInfo>(new DevicesGenerator);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Additional assertion
|
||||
|
||||
|
@ -94,9 +94,7 @@ private:
|
||||
std::vector<cv::gpu::DeviceInfo> devices_;
|
||||
};
|
||||
|
||||
testing::internal::ParamGenerator<cv::gpu::DeviceInfo> DevicesGenerator_();
|
||||
|
||||
#define ALL_DEVICES DevicesGenerator_()
|
||||
#define ALL_DEVICES testing::ValuesIn(DeviceManager::instance().values())
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Additional assertion
|
||||
|
Loading…
x
Reference in New Issue
Block a user