MCPcopy Create free account
hub / github.com/Profactor/cv-plot / makeTestCase

Function makeTestCase

CvPlot/ext/catch2/inc/catch.hpp:13815–13861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13813 }
13814
13815 TestCase makeTestCase( ITestInvoker* _testCase,
13816 std::string const& _className,
13817 NameAndTags const& nameAndTags,
13818 SourceLineInfo const& _lineInfo )
13819 {
13820 bool isHidden = false;
13821
13822 // Parse out tags
13823 std::vector<std::string> tags;
13824 std::string desc, tag;
13825 bool inTag = false;
13826 for (char c : nameAndTags.tags) {
13827 if( !inTag ) {
13828 if( c == '[' )
13829 inTag = true;
13830 else
13831 desc += c;
13832 }
13833 else {
13834 if( c == ']' ) {
13835 TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag );
13836 if( ( prop & TestCaseInfo::IsHidden ) != 0 )
13837 isHidden = true;
13838 else if( prop == TestCaseInfo::None )
13839 enforceNotReservedTag( tag, _lineInfo );
13840
13841 // Merged hide tags like `[.approvals]` should be added as
13842 // `[.][approvals]`. The `[.]` is added at later point, so
13843 // we only strip the prefix
13844 if (startsWith(tag, '.') && tag.size() > 1) {
13845 tag.erase(0, 1);
13846 }
13847 tags.push_back( tag );
13848 tag.clear();
13849 inTag = false;
13850 }
13851 else
13852 tag += c;
13853 }
13854 }
13855 if( isHidden ) {
13856 tags.push_back( "." );
13857 }
13858
13859 TestCaseInfo info( static_cast<std::string>(nameAndTags.name), _className, desc, tags, _lineInfo );
13860 return TestCase( _testCase, std::move(info) );
13861 }
13862
13863 void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {
13864 std::sort(begin(tags), end(tags));

Callers 2

registerTestMethodsFunction · 0.85
AutoRegMethod · 0.85

Calls 5

parseSpecialTagFunction · 0.85
enforceNotReservedTagFunction · 0.85
startsWithFunction · 0.85
TestCaseClass · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected