mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-22 19:33:29 +01:00
qualified a load of size_ts with std:: namespace (all those not from Clara)
This commit is contained in:
parent
40209d1ae0
commit
8da0d0473b
@ -19,8 +19,8 @@ namespace Catch {
|
||||
class BenchmarkLooper {
|
||||
|
||||
std::string m_name;
|
||||
size_t m_count = 0;
|
||||
size_t m_iterationsToRun = 1;
|
||||
std::size_t m_count = 0;
|
||||
std::size_t m_iterationsToRun = 1;
|
||||
uint64_t m_resolution;
|
||||
Timer m_timer;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
namespace Catch{
|
||||
namespace Catch {
|
||||
|
||||
// The following function is taken directly from the following technical note:
|
||||
// http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
int mib[4];
|
||||
struct kinfo_proc info;
|
||||
size_t size;
|
||||
std::size_t size;
|
||||
|
||||
// Initialize the flags so that, if sysctl fails for some bizarre
|
||||
// reason, we get a predictable result.
|
||||
|
@ -105,7 +105,7 @@ namespace Catch {
|
||||
|
||||
TestRunStats::~TestRunStats() = default;
|
||||
|
||||
void IStreamingReporter::fatalErrorEncountered( StringRef name ) {}
|
||||
void IStreamingReporter::fatalErrorEncountered( StringRef ) {}
|
||||
bool IStreamingReporter::isMulti() const { return false; }
|
||||
|
||||
IReporterFactory::~IReporterFactory() = default;
|
||||
|
@ -163,7 +163,7 @@ namespace Catch {
|
||||
};
|
||||
struct BenchmarkStats {
|
||||
BenchmarkInfo info;
|
||||
size_t iterations;
|
||||
std::size_t iterations;
|
||||
uint64_t elapsedTimeInNanoseconds;
|
||||
};
|
||||
|
||||
|
@ -78,7 +78,7 @@ namespace Matchers {
|
||||
// - then just call that directly
|
||||
if (m_comparator.size() != v.size())
|
||||
return false;
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
for (std::size_t i = 0; i < v.size(); ++i)
|
||||
if (m_comparator[i] != v[i])
|
||||
return false;
|
||||
return true;
|
||||
|
@ -72,8 +72,8 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
|
||||
inline size_t registerTestMethods() {
|
||||
size_t noTestMethods = 0;
|
||||
inline std::size_t registerTestMethods() {
|
||||
std::size_t noTestMethods = 0;
|
||||
int noClasses = objc_getClassList( nullptr, 0 );
|
||||
|
||||
Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
|
||||
|
@ -135,7 +135,7 @@ namespace Catch {
|
||||
std::vector<SectionEndInfo> m_unfinishedSections;
|
||||
std::vector<ITracker*> m_activeSections;
|
||||
TrackerContext m_trackerContext;
|
||||
size_t m_prevPassed = 0;
|
||||
std::size_t m_prevPassed = 0;
|
||||
bool m_shouldReportUnexpected = true;
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
template<typename WriterF, size_t bufferSize=256>
|
||||
template<typename WriterF, std::size_t bufferSize=256>
|
||||
class StreamBufImpl : public StreamBufBase {
|
||||
char data[bufferSize];
|
||||
WriterF m_writer;
|
||||
|
@ -25,7 +25,7 @@ namespace Catch {
|
||||
class StringRef {
|
||||
friend struct StringRefTestAccess;
|
||||
|
||||
using size_type = size_t;
|
||||
using size_type = std::size_t;
|
||||
|
||||
char const* m_start;
|
||||
size_type m_size;
|
||||
|
@ -131,7 +131,7 @@ namespace Catch {
|
||||
std::string TestCaseInfo::tagsAsString() const {
|
||||
std::string ret;
|
||||
// '[' and ']' per tag
|
||||
size_t full_size = 2 * tags.size();
|
||||
std::size_t full_size = 2 * tags.size();
|
||||
for (const auto& tag : tags) {
|
||||
full_size += tag.size();
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ namespace Catch {
|
||||
std::vector<TestCase> m_functions;
|
||||
mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder;
|
||||
mutable std::vector<TestCase> m_sortedFunctions;
|
||||
size_t m_unnamedCount = 0;
|
||||
std::size_t m_unnamedCount = 0;
|
||||
std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised
|
||||
};
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace Catch {
|
||||
template<typename T>
|
||||
void addPattern() {
|
||||
std::string token = subString();
|
||||
for( size_t i = 0; i < m_escapeChars.size(); ++i )
|
||||
for( std::size_t i = 0; i < m_escapeChars.size(); ++i )
|
||||
token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 );
|
||||
m_escapeChars.clear();
|
||||
if( startsWith( token, "exclude:" ) ) {
|
||||
|
@ -20,7 +20,7 @@ namespace Catch {
|
||||
uint64_t sum = 0;
|
||||
static const uint64_t iterations = 1000000;
|
||||
|
||||
for( size_t i = 0; i < iterations; ++i ) {
|
||||
for( std::size_t i = 0; i < iterations; ++i ) {
|
||||
|
||||
uint64_t ticks;
|
||||
uint64_t baseTicks = getCurrentNanosecondsSinceEpoch();
|
||||
|
@ -28,7 +28,7 @@ namespace Catch {
|
||||
// + 1 for decimal point
|
||||
// + 3 for the 3 decimal places
|
||||
// + 1 for null terminator
|
||||
const size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
|
||||
const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
|
||||
char buffer[maxDoubleSize];
|
||||
|
||||
// Save previous errno, to prevent sprintf from overwriting it
|
||||
|
@ -95,7 +95,7 @@ namespace {
|
||||
tp.m_currentColumn++;
|
||||
|
||||
auto colInfo = tp.m_columnInfos[tp.m_currentColumn];
|
||||
auto padding = ( strSize+2 < static_cast<size_t>( colInfo.width ) )
|
||||
auto padding = ( strSize+2 < static_cast<std::size_t>( colInfo.width ) )
|
||||
? std::string( colInfo.width-(strSize+2), ' ' )
|
||||
: std::string();
|
||||
if( colInfo.justification == ColumnInfo::Left )
|
||||
|
@ -26,7 +26,7 @@ namespace Catch {
|
||||
// Also, UTC only, again because of backward compatibility (%z is C++11)
|
||||
time_t rawtime;
|
||||
std::time(&rawtime);
|
||||
const size_t timeStampSize = sizeof("2017-01-16T17:06:45Z");
|
||||
auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
|
||||
|
||||
#ifdef _MSC_VER
|
||||
std::tm timeInfo = {};
|
||||
|
@ -59,12 +59,12 @@ namespace Catch {
|
||||
}
|
||||
|
||||
private:
|
||||
size_t counter = 0;
|
||||
std::size_t counter = 0;
|
||||
class AssertionPrinter {
|
||||
public:
|
||||
AssertionPrinter& operator= ( AssertionPrinter const& ) = delete;
|
||||
AssertionPrinter( AssertionPrinter const& ) = delete;
|
||||
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, size_t _counter )
|
||||
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter )
|
||||
: stream( _stream )
|
||||
, result( _stats.assertionResult )
|
||||
, messages( _stats.infoMessages )
|
||||
@ -232,7 +232,7 @@ namespace Catch {
|
||||
std::vector<MessageInfo> messages;
|
||||
std::vector<MessageInfo>::const_iterator itMessage;
|
||||
bool printInfoMessages;
|
||||
size_t counter;
|
||||
std::size_t counter;
|
||||
};
|
||||
|
||||
void printTotals( const Totals& totals ) const {
|
||||
|
@ -11,11 +11,11 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
TEST_CASE("Successful tests -- REQUIRE", "[Success]") {
|
||||
const size_t sz = 1 * 1024 * 1024;
|
||||
const std::size_t sz = 1 * 1024 * 1024;
|
||||
|
||||
|
||||
std::vector<size_t> vec; vec.reserve(sz);
|
||||
for (size_t i = 0; i < sz; ++i){
|
||||
std::vector<std::size_t> vec; vec.reserve(sz);
|
||||
for (std::size_t i = 0; i < sz; ++i){
|
||||
vec.push_back(i);
|
||||
REQUIRE(vec.back() == i);
|
||||
}
|
||||
@ -23,11 +23,11 @@ TEST_CASE("Successful tests -- REQUIRE", "[Success]") {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
TEST_CASE("Successful tests -- CHECK", "[Success]") {
|
||||
const size_t sz = 1 * 1024 * 1024;
|
||||
const std::size_t sz = 1 * 1024 * 1024;
|
||||
|
||||
|
||||
std::vector<size_t> vec; vec.reserve(sz);
|
||||
for (size_t i = 0; i < sz; ++i){
|
||||
std::vector<std::size_t> vec; vec.reserve(sz);
|
||||
for (std::size_t i = 0; i < sz; ++i){
|
||||
vec.push_back(i);
|
||||
CHECK(vec.back() == i);
|
||||
}
|
||||
@ -35,11 +35,11 @@ TEST_CASE("Successful tests -- CHECK", "[Success]") {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
TEST_CASE("Unsuccessful tests -- CHECK", "[Failure]") {
|
||||
const size_t sz = 1024 * 1024;
|
||||
const std::size_t sz = 1024 * 1024;
|
||||
|
||||
|
||||
std::vector<size_t> vec; vec.reserve(sz);
|
||||
for (size_t i = 0; i < sz; ++i){
|
||||
std::vector<std::size_t> vec; vec.reserve(sz);
|
||||
for (std::size_t i = 0; i < sz; ++i){
|
||||
vec.push_back(i);
|
||||
CHECK(vec.size() == i);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ TEST_CASE( "looped SECTION tests", "[.][failing][sections]" ) {
|
||||
TEST_CASE( "looped tests", "[.][failing]" ) {
|
||||
static const int fib[] = { 1, 1, 2, 3, 5, 8, 13, 21 };
|
||||
|
||||
for( size_t i=0; i < sizeof(fib)/sizeof(int); ++i ) {
|
||||
for( std::size_t i=0; i < sizeof(fib)/sizeof(int); ++i ) {
|
||||
INFO( "Testing if fib[" << i << "] (" << fib[i] << ") is even" );
|
||||
CHECK( ( fib[i] % 2 ) == 0 );
|
||||
}
|
||||
@ -163,7 +163,7 @@ TEST_CASE( "send a single char to INFO", "[failing][.]" ) {
|
||||
}
|
||||
|
||||
TEST_CASE( "atomic if", "[failing][0]") {
|
||||
size_t x = 0;
|
||||
std::size_t x = 0;
|
||||
|
||||
if( x )
|
||||
REQUIRE(x > 0);
|
||||
|
Loading…
Reference in New Issue
Block a user