15 #ifndef INCG_IRIS_IUTEST_UTIL_TESTS_HPP_4095FF9B_D6B8_4CD3_BF86_43DFED1760EA_
16 #define INCG_IRIS_IUTEST_UTIL_TESTS_HPP_4095FF9B_D6B8_4CD3_BF86_43DFED1760EA_
29 inline ::std::string
TestFullName(const ::iutest::TestInfo* test_info)
31 ::std::string fullname = test_info->test_case_name();
33 fullname += test_info->name();
42 const char*
const p = strrchr(name,
'/');
47 return ::std::string(name, p);
64 const char*
const pkg = strrchr(name,
'.');
66 const char*
const p1 = strchr(name,
'/');
84 inline const ::iutest::TestCase*
FindTestCase(
const char* testcase_name)
86 if( testcase_name == NULL )
91 for(
int i=0; i < testcase_count; ++i )
94 if( strcmp(testcase->name(), testcase_name) == 0 )
105 inline const ::iutest::TestCase*
FindParamTestCase(
const char* testcase_name, const ::iutest::TestCase* begin=NULL)
107 if( testcase_name == NULL )
115 for( ; i < testcase_count; ++i )
118 if( testcase == begin )
125 for( ; i < testcase_count; ++i )
128 const char* testcase_origin_name = strchr(testcase->name(),
'/');
129 if( testcase_origin_name != NULL )
131 if( strcmp(testcase_origin_name+1, testcase_name) == 0 )
143 inline const ::iutest::TestCase*
FindTypedTestCase(
const char* testcase_name, const ::iutest::TestCase* begin=NULL)
145 if( testcase_name == NULL )
153 for( ; i < testcase_count; ++i )
156 if( testcase == begin )
163 for( ; i < testcase_count; ++i )
166 if( testcase != NULL )
168 const char* name = testcase->
name();
170 && strstr(name, testcase_name) == name
171 && name[strlen(testcase_name)] ==
'/' )
183 inline const ::iutest::TestCase*
FindParamTypedTestCase(
const char* testcase_name, const ::iutest::TestCase* begin=NULL)
185 if( testcase_name == NULL )
193 for( ; i < testcase_count; ++i )
196 if( testcase == begin )
203 for( ; i < testcase_count; ++i )
206 const char* name = strchr(testcase->name(),
'/');
210 if( strstr(name, testcase_name) == name
211 && name[strlen(testcase_name)] ==
'/' )
223 inline const ::iutest::TestInfo*
FindTestInfo(const ::iutest::TestCase* testcase,
const char* testinfo_name)
225 if( testcase == NULL || testinfo_name == NULL )
230 const int testinfo_count = testcase->total_test_count();
231 for(
int i=0; i < testinfo_count; ++i )
233 const ::iutest::TestInfo* testinfo = testcase->GetTestInfo(i);
234 if( strcmp(testinfo->name(), testinfo_name) == 0 )
245 inline const ::iutest::TestInfo*
FindTestInfo(
const char* testcase_name,
const char* testinfo_name)
247 if( testcase_name == NULL || testinfo_name == NULL )
251 const ::iutest::TestCase* testcase =
FindTestCase(testcase_name);
258 inline const ::iutest::TestInfo*
FindParamTestInfo(const ::iutest::TestCase* testcase,
const char* testinfo_name
259 , const ::iutest::TestInfo* begin=NULL)
261 if( testcase == NULL || testinfo_name == NULL )
266 const int testinfo_count = testcase->total_test_count();
270 for( ; i < testinfo_count; ++i )
272 const ::iutest::TestInfo* testinfo = testcase->GetTestInfo(i);
273 if( testinfo == begin )
281 for( ; i < testinfo_count; ++i )
283 const ::iutest::TestInfo* testinfo = testcase->GetTestInfo(i);
284 if( testinfo != NULL )
286 const char* name = testinfo->name();
288 && strstr(name, testinfo_name) == name
289 && name[strlen(testinfo_name)] ==
'/' )
301 inline const ::iutest::TestResult* TestResultPointer(const ::iutest::TestResult* result)
308 inline const ::iutest::TestResult* TestResultPointer(const ::iutest::TestResult& result)
318 #if !defined(IUTEST_NO_UNITEST_AD_HOC_TEST_RESULT_ACCESSOR)
330 #if !defined(IUTEST_NO_TESTCASE_AD_HOC_TEST_RESULT_ACCESSOR)
331 return TestResultPointer(test_case->ad_hoc_test_result());
333 IUTEST_UNUSED_VAR(test_case);
349 inline const ::iutest::TestResult*
GetTestResult(const ::iutest::TestInfo* test_info)
351 return TestResultPointer(test_info->result());
364 #endif // INCG_IRIS_IUTEST_UTIL_TESTS_HPP_4095FF9B_D6B8_4CD3_BF86_43DFED1760EA_