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