mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 12:22:51 +08:00
ts: fix PERF_TEST() macro to allow test_case name reusing
Example (reuse 'Transform' test case): PERF_TEST(Transform, getPerspectiveTransform_1000) { ... } PERF_TEST(Transform, getPerspectiveTransform_QR_1000) { ... }
This commit is contained in:
parent
6c4f618db5
commit
f4df537e27
@ -44,13 +44,13 @@ extern int testThreads;
|
|||||||
|
|
||||||
|
|
||||||
#undef TEST
|
#undef TEST
|
||||||
#define TEST_(test_case_name, test_name, BODY_IMPL) \
|
#define TEST_(test_case_name, test_name, parent_class, bodyMethodName, BODY_IMPL) \
|
||||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public ::testing::Test {\
|
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
|
||||||
public:\
|
public:\
|
||||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
|
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
|
||||||
private:\
|
private:\
|
||||||
virtual void TestBody() CV_OVERRIDE;\
|
virtual void TestBody() CV_OVERRIDE;\
|
||||||
virtual void Body();\
|
virtual void bodyMethodName();\
|
||||||
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
|
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
|
||||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
|
GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
|
||||||
@ -62,14 +62,14 @@ extern int testThreads;
|
|||||||
#test_case_name, #test_name, NULL, NULL, \
|
#test_case_name, #test_name, NULL, NULL, \
|
||||||
::testing::internal::CodeLocation(__FILE__, __LINE__), \
|
::testing::internal::CodeLocation(__FILE__, __LINE__), \
|
||||||
(::testing::internal::GetTestTypeId()), \
|
(::testing::internal::GetTestTypeId()), \
|
||||||
::testing::Test::SetUpTestCase, \
|
parent_class::SetUpTestCase, \
|
||||||
::testing::Test::TearDownTestCase, \
|
parent_class::TearDownTestCase, \
|
||||||
new ::testing::internal::TestFactoryImpl<\
|
new ::testing::internal::TestFactoryImpl<\
|
||||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
|
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
|
||||||
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)::TestBody() BODY_IMPL( #test_case_name "_" #test_name ) \
|
||||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::Body()
|
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::bodyMethodName()
|
||||||
|
|
||||||
#define TEST(test_case_name, test_name) TEST_(test_case_name, test_name, CV__TEST_BODY_IMPL)
|
#define TEST(test_case_name, test_name) TEST_(test_case_name, test_name, ::testing::Test, Body, CV__TEST_BODY_IMPL)
|
||||||
|
|
||||||
#define CV__TEST_BIGDATA_BODY_IMPL(name) \
|
#define CV__TEST_BIGDATA_BODY_IMPL(name) \
|
||||||
{ \
|
{ \
|
||||||
@ -92,9 +92,9 @@ extern int testThreads;
|
|||||||
|
|
||||||
// Special type of tests which require / use or validate processing of huge amount of data (>= 2Gb)
|
// Special type of tests which require / use or validate processing of huge amount of data (>= 2Gb)
|
||||||
#if defined(_M_X64) || defined(__x86_64__) || defined(__aarch64__)
|
#if defined(_M_X64) || defined(__x86_64__) || defined(__aarch64__)
|
||||||
#define BIGDATA_TEST(test_case_name, test_name) TEST_(BigData_ ## test_case_name, test_name, CV__TEST_BIGDATA_BODY_IMPL)
|
#define BIGDATA_TEST(test_case_name, test_name) TEST_(BigData_ ## test_case_name, test_name, ::testing::Test, Body, CV__TEST_BIGDATA_BODY_IMPL)
|
||||||
#else
|
#else
|
||||||
#define BIGDATA_TEST(test_case_name, test_name) TEST_(BigData_ ## test_case_name, DISABLED_ ## test_name, CV__TEST_BIGDATA_BODY_IMPL)
|
#define BIGDATA_TEST(test_case_name, test_name) TEST_(BigData_ ## test_case_name, DISABLED_ ## test_name, ::testing::Test, Body, CV__TEST_BIGDATA_BODY_IMPL)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef TEST_F
|
#undef TEST_F
|
||||||
|
@ -546,17 +546,7 @@ void PrintTo(const Size& sz, ::std::ostream* os);
|
|||||||
// EXPECT_TRUE(foo.StatusIsOK());
|
// EXPECT_TRUE(foo.StatusIsOK());
|
||||||
// }
|
// }
|
||||||
#define PERF_TEST(test_case_name, test_name)\
|
#define PERF_TEST(test_case_name, test_name)\
|
||||||
namespace PERF_PROXY_NAMESPACE_NAME_(test_case_name, test_name) {\
|
TEST_(test_case_name, test_name, ::perf::TestBase, PerfTestBody, CV__PERF_TEST_BODY_IMPL)
|
||||||
class TestBase {/*compile error for this class means that you are trying to use perf::TestBase as a fixture*/};\
|
|
||||||
class test_case_name : public ::perf::TestBase {\
|
|
||||||
public:\
|
|
||||||
test_case_name() {}\
|
|
||||||
protected:\
|
|
||||||
virtual void PerfTestBody();\
|
|
||||||
};\
|
|
||||||
TEST_F(test_case_name, test_name){ CV__PERF_TEST_BODY_IMPL(#test_case_name "_" #test_name); }\
|
|
||||||
}\
|
|
||||||
void PERF_PROXY_NAMESPACE_NAME_(test_case_name, test_name)::test_case_name::PerfTestBody()
|
|
||||||
|
|
||||||
// Defines a performance test that uses a test fixture.
|
// Defines a performance test that uses a test fixture.
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user