mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 23:20:05 +02:00
Reapply clang-format.
$ clang-format -i -style=file \ $(find . | egrep '.*\.(h|cpp|inl)$')
This commit is contained in:
@@ -73,8 +73,7 @@ namespace JsonTest {
|
||||
// class TestResult
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
|
||||
TestResult::TestResult()
|
||||
{
|
||||
TestResult::TestResult() {
|
||||
// The root predicate has id 0
|
||||
rootPredicateNode_.id_ = 0;
|
||||
rootPredicateNode_.next_ = nullptr;
|
||||
@@ -150,7 +149,7 @@ void TestResult::printFailure(bool printTestName) const {
|
||||
}
|
||||
|
||||
// Print in reverse to display the callstack in the right order
|
||||
for (const auto & failure : failures_ ) {
|
||||
for (const auto& failure : failures_) {
|
||||
JSONCPP_STRING indent(failure.nestingLevel_ * 2, ' ');
|
||||
if (failure.file_) {
|
||||
printf("%s%s(%u): ", indent.c_str(), failure.file_, failure.line_);
|
||||
@@ -205,7 +204,7 @@ TestResult& TestResult::operator<<(bool value) {
|
||||
// class TestCase
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
|
||||
TestCase::TestCase() = default;
|
||||
TestCase::TestCase() = default;
|
||||
|
||||
TestCase::~TestCase() = default;
|
||||
|
||||
@@ -224,9 +223,7 @@ Runner& Runner::add(TestCaseFactory factory) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t Runner::testCount() const {
|
||||
return tests_.size();
|
||||
}
|
||||
size_t Runner::testCount() const { return tests_.size(); }
|
||||
|
||||
JSONCPP_STRING Runner::testNameAt(size_t index) const {
|
||||
TestCase* test = tests_[index]();
|
||||
@@ -273,22 +270,21 @@ bool Runner::runAllTest(bool printSummary) const {
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
for (auto & result : failures) {
|
||||
for (auto& result : failures) {
|
||||
result.printFailure(count > 1);
|
||||
}
|
||||
|
||||
if (printSummary) {
|
||||
size_t const failedCount = failures.size();
|
||||
size_t const passedCount = count - failedCount;
|
||||
printf("%zu/%zu tests passed (%zu failure(s))\n",
|
||||
passedCount, count, failedCount);
|
||||
printf("%zu/%zu tests passed (%zu failure(s))\n", passedCount, count,
|
||||
failedCount);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Runner::testIndex(const JSONCPP_STRING& testName,
|
||||
size_t& indexOut) const {
|
||||
bool Runner::testIndex(const JSONCPP_STRING& testName, size_t& indexOut) const {
|
||||
const size_t count = testCount();
|
||||
for (size_t index = 0; index < count; ++index) {
|
||||
if (testNameAt(index) == testName) {
|
||||
|
@@ -6,12 +6,12 @@
|
||||
#ifndef JSONTEST_H_INCLUDED
|
||||
#define JSONTEST_H_INCLUDED
|
||||
|
||||
#include <cstdio>
|
||||
#include <deque>
|
||||
#include <json/config.h>
|
||||
#include <json/value.h>
|
||||
#include <json/writer.h>
|
||||
#include <sstream>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
/// Not encapsulated to prevent step into when debugging failed assertions
|
||||
/// Incremented by one on assertion predicate entry, decreased by one
|
||||
/// by addPredicateContext().
|
||||
PredicateContext::Id predicateId_{1};
|
||||
PredicateContext::Id predicateId_{ 1 };
|
||||
|
||||
/// \internal Implementation detail for predicate macros
|
||||
PredicateContext* predicateStackTail_;
|
||||
@@ -109,9 +109,9 @@ private:
|
||||
Failures failures_;
|
||||
JSONCPP_STRING name_;
|
||||
PredicateContext rootPredicateNode_;
|
||||
PredicateContext::Id lastUsedPredicateId_{0};
|
||||
PredicateContext::Id lastUsedPredicateId_{ 0 };
|
||||
/// Failure which is the target of the messages added using operator <<
|
||||
Failure* messageTarget_{nullptr};
|
||||
Failure* messageTarget_{ nullptr };
|
||||
};
|
||||
|
||||
class TestCase {
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
virtual const char* testName() const = 0;
|
||||
|
||||
protected:
|
||||
TestResult* result_{nullptr};
|
||||
TestResult* result_{ nullptr };
|
||||
|
||||
private:
|
||||
virtual void runTestCase() = 0;
|
||||
@@ -262,9 +262,7 @@ TestResult& checkStringEqual(TestResult& result,
|
||||
} \
|
||||
\
|
||||
public: /* overridden from TestCase */ \
|
||||
const char* testName() const override { \
|
||||
return #FixtureType "/" #name; \
|
||||
} \
|
||||
const char* testName() const override { return #FixtureType "/" #name; } \
|
||||
void runTestCase() override; \
|
||||
}; \
|
||||
\
|
||||
|
@@ -82,19 +82,19 @@ struct ValueTest : JsonTest::TestCase {
|
||||
/// Initialize all checks to \c false by default.
|
||||
IsCheck();
|
||||
|
||||
bool isObject_{false};
|
||||
bool isArray_{false};
|
||||
bool isBool_{false};
|
||||
bool isString_{false};
|
||||
bool isNull_{false};
|
||||
bool isObject_{ false };
|
||||
bool isArray_{ false };
|
||||
bool isBool_{ false };
|
||||
bool isString_{ false };
|
||||
bool isNull_{ false };
|
||||
|
||||
bool isInt_{false};
|
||||
bool isInt64_{false};
|
||||
bool isUInt_{false};
|
||||
bool isUInt64_{false};
|
||||
bool isIntegral_{false};
|
||||
bool isDouble_{false};
|
||||
bool isNumeric_{false};
|
||||
bool isInt_{ false };
|
||||
bool isInt64_{ false };
|
||||
bool isUInt_{ false };
|
||||
bool isUInt64_{ false };
|
||||
bool isIntegral_{ false };
|
||||
bool isDouble_{ false };
|
||||
bool isNumeric_{ false };
|
||||
};
|
||||
|
||||
void checkConstMemberCount(const Json::Value& value,
|
||||
@@ -1331,8 +1331,8 @@ void ValueTest::checkMemberCount(Json::Value& value,
|
||||
}
|
||||
|
||||
ValueTest::IsCheck::IsCheck()
|
||||
|
||||
= default;
|
||||
|
||||
= default;
|
||||
|
||||
void ValueTest::checkIs(const Json::Value& value, const IsCheck& check) {
|
||||
JSONTEST_ASSERT_EQUAL(check.isObject_, value.isObject());
|
||||
@@ -2354,14 +2354,22 @@ JSONTEST_FIXTURE(CharReaderAllowSpecialFloatsTest, issue209) {
|
||||
JSONCPP_STRING in;
|
||||
};
|
||||
const TestData test_data[] = {
|
||||
{ __LINE__, true, "{\"a\":9}" }, { __LINE__, false, "{\"a\":0Infinity}" },
|
||||
{ __LINE__, false, "{\"a\":1Infinity}" }, { __LINE__, false, "{\"a\":9Infinity}" },
|
||||
{ __LINE__, false, "{\"a\":0nfinity}" }, { __LINE__, false, "{\"a\":1nfinity}" },
|
||||
{ __LINE__, false, "{\"a\":9nfinity}" }, { __LINE__, false, "{\"a\":nfinity}" },
|
||||
{ __LINE__, false, "{\"a\":.nfinity}" }, { __LINE__, false, "{\"a\":9nfinity}" },
|
||||
{ __LINE__, false, "{\"a\":-nfinity}" }, { __LINE__, true, "{\"a\":Infinity}" },
|
||||
{ __LINE__, false, "{\"a\":.Infinity}" }, { __LINE__, false, "{\"a\":_Infinity}" },
|
||||
{ __LINE__, false, "{\"a\":_nfinity}" }, { __LINE__, true, "{\"a\":-Infinity}" }
|
||||
{ __LINE__, true, "{\"a\":9}" }, //
|
||||
{ __LINE__, false, "{\"a\":0Infinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":1Infinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":9Infinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":0nfinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":1nfinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":9nfinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":nfinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":.nfinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":9nfinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":-nfinity}" }, //
|
||||
{ __LINE__, true, "{\"a\":Infinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":.Infinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":_Infinity}" }, //
|
||||
{ __LINE__, false, "{\"a\":_nfinity}" }, //
|
||||
{ __LINE__, true, "{\"a\":-Infinity}" } //
|
||||
};
|
||||
for (const auto& td : test_data) {
|
||||
bool ok = reader->parse(&*td.in.begin(), &*td.in.begin() + td.in.size(),
|
||||
|
Reference in New Issue
Block a user