mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -31,6 +31,8 @@ bool checkBigDataTests();
|
||||
|
||||
#define CV__TEST_INIT \
|
||||
CV__TEST_NAMESPACE_CHECK \
|
||||
if (setUpSkipped) \
|
||||
return; \
|
||||
::cvtest::testSetUp();
|
||||
#define CV__TEST_CLEANUP ::cvtest::testTearDown();
|
||||
#define CV__TEST_BODY_IMPL(name) \
|
||||
@@ -47,6 +49,25 @@ bool checkBigDataTests();
|
||||
} \
|
||||
} \
|
||||
|
||||
#define CV__TEST_SETUP_IMPL(parent_class) { \
|
||||
setUpSkipped = false; \
|
||||
try { \
|
||||
parent_class::SetUp(); \
|
||||
} catch (const cvtest::details::SkipTestExceptionBase& e) { \
|
||||
setUpSkipped = true; \
|
||||
printf("[ SKIP ] %s\n", e.what()); \
|
||||
} \
|
||||
} \
|
||||
|
||||
struct SkipThisTest : public ::testing::Test {
|
||||
SkipThisTest(const std::string& msg_) : msg(msg_) {}
|
||||
|
||||
virtual void TestBody() CV_OVERRIDE {
|
||||
printf("[ SKIP ] %s\n", msg.c_str());
|
||||
}
|
||||
|
||||
std::string msg;
|
||||
};
|
||||
|
||||
#undef TEST
|
||||
#define TEST_(test_case_name, test_name, parent_class, bodyMethodName, BODY_ATTR, BODY_IMPL) \
|
||||
@@ -54,12 +75,24 @@ bool checkBigDataTests();
|
||||
public:\
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
|
||||
private:\
|
||||
bool setUpSkipped = false; \
|
||||
virtual void TestBody() CV_OVERRIDE;\
|
||||
virtual void bodyMethodName() BODY_ATTR;\
|
||||
virtual void SetUp() CV_OVERRIDE; \
|
||||
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
|
||||
};\
|
||||
class test_case_name##test_name##_factory : public ::testing::internal::TestFactoryBase { \
|
||||
public:\
|
||||
virtual ::testing::Test* CreateTest() { \
|
||||
try { \
|
||||
return new GTEST_TEST_CLASS_NAME_(test_case_name, test_name); \
|
||||
} catch (const cvtest::details::SkipTestExceptionBase& e) { \
|
||||
return new SkipThisTest(e.what()); \
|
||||
} \
|
||||
} \
|
||||
};\
|
||||
\
|
||||
::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
|
||||
::test_info_ =\
|
||||
@@ -69,9 +102,9 @@ bool checkBigDataTests();
|
||||
(::testing::internal::GetTestTypeId()), \
|
||||
parent_class::SetUpTestCase, \
|
||||
parent_class::TearDownTestCase, \
|
||||
new ::testing::internal::TestFactoryImpl<\
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
|
||||
new test_case_name##test_name##_factory);\
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() BODY_IMPL( #test_case_name "_" #test_name ) \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::SetUp() CV__TEST_SETUP_IMPL(parent_class) \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::bodyMethodName()
|
||||
|
||||
#define TEST(test_case_name, test_name) TEST_(test_case_name, test_name, ::testing::Test, Body,, CV__TEST_BODY_IMPL)
|
||||
@@ -107,12 +140,24 @@ bool checkBigDataTests();
|
||||
public:\
|
||||
GTEST_TEST_CLASS_NAME_(test_fixture, test_name)() {}\
|
||||
private:\
|
||||
bool setUpSkipped = false; \
|
||||
virtual void TestBody() CV_OVERRIDE;\
|
||||
virtual void Body(); \
|
||||
virtual void SetUp() CV_OVERRIDE; \
|
||||
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
|
||||
GTEST_TEST_CLASS_NAME_(test_fixture, test_name));\
|
||||
};\
|
||||
class test_fixture##test_name##_factory : public ::testing::internal::TestFactoryBase { \
|
||||
public:\
|
||||
virtual ::testing::Test* CreateTest() { \
|
||||
try { \
|
||||
return new GTEST_TEST_CLASS_NAME_(test_fixture, test_name); \
|
||||
} catch (const cvtest::details::SkipTestExceptionBase& e) { \
|
||||
return new SkipThisTest(e.what()); \
|
||||
} \
|
||||
} \
|
||||
};\
|
||||
\
|
||||
::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_fixture, test_name)\
|
||||
::test_info_ =\
|
||||
@@ -122,9 +167,9 @@ bool checkBigDataTests();
|
||||
(::testing::internal::GetTypeId<test_fixture>()), \
|
||||
test_fixture::SetUpTestCase, \
|
||||
test_fixture::TearDownTestCase, \
|
||||
new ::testing::internal::TestFactoryImpl<\
|
||||
GTEST_TEST_CLASS_NAME_(test_fixture, test_name)>);\
|
||||
new test_fixture##test_name##_factory);\
|
||||
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::TestBody() CV__TEST_BODY_IMPL( #test_fixture "_" #test_name ) \
|
||||
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::SetUp() CV__TEST_SETUP_IMPL(test_fixture) \
|
||||
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::Body()
|
||||
|
||||
// Don't use directly
|
||||
@@ -134,8 +179,10 @@ bool checkBigDataTests();
|
||||
public: \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
|
||||
private: \
|
||||
bool setUpSkipped = false; \
|
||||
virtual void bodyMethodName() BODY_ATTR; \
|
||||
virtual void TestBody() CV_OVERRIDE; \
|
||||
virtual void SetUp() CV_OVERRIDE; \
|
||||
static int AddToRegistry() { \
|
||||
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
|
||||
GetTestCasePatternHolder<test_case_name>(\
|
||||
@@ -157,6 +204,7 @@ bool checkBigDataTests();
|
||||
test_name)::gtest_registering_dummy_ = \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() BODY_IMPL( #test_case_name "_" #test_name ) \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::SetUp() CV__TEST_SETUP_IMPL(test_case_name) \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::bodyMethodName()
|
||||
|
||||
#undef TEST_P
|
||||
|
||||
Reference in New Issue
Block a user