27 else if( tag ==
"!throws" )
29 else if( tag ==
"!shouldfail" )
31 else if( tag ==
"!mayfail" )
33 else if( tag ==
"!nonportable" )
35 else if( tag ==
"!benchmark" )
40 bool isReservedTag( std::string
const& tag ) {
41 return parseSpecialTag( tag ) ==
TestCaseInfo::None && tag.size() > 0 && !std::isalnum(
static_cast<unsigned char>(tag[0]) );
43 void enforceNotReservedTag( std::string
const& tag, SourceLineInfo
const& _lineInfo ) {
45 "Tag name: [" << tag <<
"] is not allowed.\n"
46 <<
"Tag names starting with non alphanumeric characters are reserved\n"
52 std::string
const& _className,
56 bool isHidden =
false;
59 std::vector<std::string> tags;
60 std::string desc, tag;
62 std::string _descOrTags = nameAndTags.
tags;
63 for (
char c : _descOrTags) {
76 enforceNotReservedTag( tag, _lineInfo );
84 tags.push_back( tag );
93 tags.push_back(
"." );
97 return TestCase( _testCase, std::move(info) );
102 tags.erase(std::unique(
begin(tags),
end(tags)),
end(tags));
105 for(
auto const& tag : tags ) {
106 std::string lcaseTag =
toLower( tag );
108 testCaseInfo.
lcaseTags.push_back( lcaseTag );
110 testCaseInfo.
tags = std::move(tags);
114 std::string
const& _className,
115 std::string
const& _description,
116 std::vector<std::string>
const& _tags,
119 className( _className ),
120 description( _description ),
121 lineInfo( _lineInfo ),
143 std::size_t full_size = 2 *
tags.size();
144 for (
const auto& tag :
tags) {
145 full_size += tag.size();
147 ret.reserve(full_size);
148 for (
const auto& tag :
tags) {
163 other.name = _newName;
172 return test.get() == other.test.get() &&
173 name == other.name &&
178 return name < other.name;
#define CATCH_ENFORCE(condition, msg)
bool operator<(TestCase const &other) const
TestCase withName(std::string const &_newName) const
bool operator==(TestCase const &other) const
TestCaseInfo const & getTestCaseInfo() const
TestCase(ITestInvoker *testCase, TestCaseInfo &&info)
TestCase makeTestCase(ITestInvoker *_testCase, std::string const &_className, NameAndTags const &nameAndTags, SourceLineInfo const &_lineInfo)
void setTags(TestCaseInfo &testCaseInfo, std::vector< std::string > tags)
bool startsWith(std::string const &s, std::string const &prefix)
std::string toLower(std::string const &s)
friend void setTags(TestCaseInfo &testCaseInfo, std::vector< std::string > tags)
std::vector< std::string > lcaseTags
std::string tagsAsString() const
bool expectedToFail() const
TestCaseInfo(std::string const &_name, std::string const &_className, std::string const &_description, std::vector< std::string > const &_tags, SourceLineInfo const &_lineInfo)
std::vector< std::string > tags
SpecialProperties properties