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

Function makeTestCase

Source/ThirdParty/catch2/catch.hpp:14045–14092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14043 }
14044
14045 TestCase makeTestCase( ITestInvoker* _testCase,
14046 std::string const& _className,
14047 NameAndTags const& nameAndTags,
14048 SourceLineInfo const& _lineInfo )
14049 {
14050 bool isHidden = false;
14051
14052 // Parse out tags
14053 std::vector<std::string> tags;
14054 std::string desc, tag;
14055 bool inTag = false;
14056 for (char c : nameAndTags.tags) {
14057 if( !inTag ) {
14058 if( c == '[' )
14059 inTag = true;
14060 else
14061 desc += c;
14062 }
14063 else {
14064 if( c == ']' ) {
14065 TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag );
14066 if( ( prop & TestCaseInfo::IsHidden ) != 0 )
14067 isHidden = true;
14068 else if( prop == TestCaseInfo::None )
14069 enforceNotReservedTag( tag, _lineInfo );
14070
14071 // Merged hide tags like `[.approvals]` should be added as
14072 // `[.][approvals]`. The `[.]` is added at later point, so
14073 // we only strip the prefix
14074 if (startsWith(tag, '.') && tag.size() > 1) {
14075 tag.erase(0, 1);
14076 }
14077 tags.push_back( tag );
14078 tag.clear();
14079 inTag = false;
14080 }
14081 else
14082 tag += c;
14083 }
14084 }
14085 if( isHidden ) {
14086 // Add all "hidden" tags to make them behave identically
14087 tags.insert( tags.end(), { ".", "!hide" } );
14088 }
14089
14090 TestCaseInfo info( static_cast<std::string>(nameAndTags.name), _className, desc, tags, _lineInfo );
14091 return TestCase( _testCase, std::move(info) );
14092 }
14093
14094 void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {
14095 std::sort(begin(tags), end(tags));

Callers 2

registerTestMethodsFunction · 0.85
AutoRegMethod · 0.85

Calls 10

parseSpecialTagFunction · 0.85
enforceNotReservedTagFunction · 0.85
startsWithFunction · 0.85
TestCaseClass · 0.85
sizeMethod · 0.45
eraseMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45
insertMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected