Added benchmark for previous commit, added iterations to failure bench.

This commit is contained in:
Martin Hořeňovský committed 2017-01-25 22:39:43 +01:00
1 parent 3b98a0166f
commit 83f4b39680
3 files changed
+6 -5

No files matched your search

+2 -4
View File
@@ -10,21 +10,19 @@
#include "catch_common.h"
#include <algorithm>
namespace Catch {
bool startsWith( std::string const& s, std::string const& prefix ) {
return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());
}
bool startsWith( std::string const& s, char prefix ) {
return !s.empty() && s.front() == prefix;
return !s.empty() && s[0] == prefix;
}
bool endsWith( std::string const& s, std::string const& suffix ) {
return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());
}
bool endsWith( std::string const& s, char suffix ) {
return !s.empty() && s.back() == suffix;
return !s.empty() && s[s.size()-1] == suffix;
}
bool contains( std::string const& s, std::string const& infix ) {
return s.find( infix ) != std::string::npos;