MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / makeTestCase

Function makeTestCase

extlibs/catch/include/catch/catch.hpp:13476–13523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13474 }
13475
13476 TestCase makeTestCase( ITestInvoker* _testCase,
13477 std::string const& _className,
13478 NameAndTags const& nameAndTags,
13479 SourceLineInfo const& _lineInfo )
13480 {
13481 bool isHidden = false;
13482
13483 // Parse out tags
13484 std::vector<std::string> tags;
13485 std::string desc, tag;
13486 bool inTag = false;
13487 std::string _descOrTags = nameAndTags.tags;
13488 for (char c : _descOrTags) {
13489 if( !inTag ) {
13490 if( c == '[' )
13491 inTag = true;
13492 else
13493 desc += c;
13494 }
13495 else {
13496 if( c == ']' ) {
13497 TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag );
13498 if( ( prop & TestCaseInfo::IsHidden ) != 0 )
13499 isHidden = true;
13500 else if( prop == TestCaseInfo::None )
13501 enforceNotReservedTag( tag, _lineInfo );
13502
13503 // Merged hide tags like `[.approvals]` should be added as
13504 // `[.][approvals]`. The `[.]` is added at later point, so
13505 // we only strip the prefix
13506 if (startsWith(tag, '.') && tag.size() > 1) {
13507 tag.erase(0, 1);
13508 }
13509 tags.push_back( tag );
13510 tag.clear();
13511 inTag = false;
13512 }
13513 else
13514 tag += c;
13515 }
13516 }
13517 if( isHidden ) {
13518 tags.push_back( "." );
13519 }
13520
13521 TestCaseInfo info( nameAndTags.name, _className, desc, tags, _lineInfo );
13522 return TestCase( _testCase, std::move(info) );
13523 }
13524
13525 void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {
13526 std::sort(begin(tags), end(tags));

Callers 2

registerTestMethodsFunction · 0.85
AutoRegMethod · 0.85

Calls 8

parseSpecialTagFunction · 0.85
enforceNotReservedTagFunction · 0.85
TestCaseClass · 0.85
startsWithFunction · 0.70
sizeMethod · 0.45
eraseMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected