Apply the formatting specified in .clang-format file.

$ clang-format --version
  clang-format version 7.0.0 (tags/google/stable/2018-01-11)
  $ clang-format -i --style=file $(find . -name '*.cpp' -o -name '*.h')
This commit is contained in:
Billy Donahue
2018-05-20 16:55:27 -04:00
parent abd39e791b
commit b5e1fe89aa
16 changed files with 1176 additions and 1285 deletions

View File

@@ -93,8 +93,8 @@ TestResult::addFailure(const char* file, unsigned int line, const char* expr) {
if (lastNode->id_ > lastUsedPredicateId_) // new PredicateContext
{
lastUsedPredicateId_ = lastNode->id_;
addFailureInfo(
lastNode->file_, lastNode->line_, lastNode->expr_, nestingLevel);
addFailureInfo(lastNode->file_, lastNode->line_, lastNode->expr_,
nestingLevel);
// Link the PredicateContext to the failure for message target when
// popping the PredicateContext.
lastNode->failure_ = &(failures_.back());
@@ -180,7 +180,7 @@ void TestResult::printFailure(bool printTestName) const {
}
JSONCPP_STRING TestResult::indentText(const JSONCPP_STRING& text,
const JSONCPP_STRING& indent) {
const JSONCPP_STRING& indent) {
JSONCPP_STRING reindented;
JSONCPP_STRING::size_type lastIndex = 0;
while (lastIndex < text.size()) {
@@ -257,8 +257,7 @@ void Runner::runTestAt(unsigned int index, TestResult& result) const {
#endif // if JSON_USE_EXCEPTION
test->run(result);
#if JSON_USE_EXCEPTION
}
catch (const std::exception& e) {
} catch (const std::exception& e) {
result.addFailure(__FILE__, __LINE__, "Unexpected exception caught:")
<< e.what();
}
@@ -294,9 +293,7 @@ bool Runner::runAllTest(bool printSummary) const {
if (printSummary) {
unsigned int failedCount = static_cast<unsigned int>(failures.size());
unsigned int passedCount = count - failedCount;
printf("%d/%d tests passed (%d failure(s))\n",
passedCount,
count,
printf("%d/%d tests passed (%d failure(s))\n", passedCount, count,
failedCount);
}
return false;
@@ -398,8 +395,8 @@ void Runner::preventDialogOnCrash() {
_CrtSetReportHook(&msvcrtSilentReportHook);
#endif // if defined(_MSC_VER)
// @todo investigate this handler (for buffer overflow)
// _set_security_error_handler
// @todo investigate this handler (for buffer overflow)
// _set_security_error_handler
#if defined(_WIN32)
// Prevents the system from popping a dialog for debugging if the
@@ -430,9 +427,7 @@ JSONCPP_STRING ToJsonString(const char* toConvert) {
return JSONCPP_STRING(toConvert);
}
JSONCPP_STRING ToJsonString(JSONCPP_STRING in) {
return in;
}
JSONCPP_STRING ToJsonString(JSONCPP_STRING in) { return in; }
#if JSONCPP_USING_SECURE_MEMORY
JSONCPP_STRING ToJsonString(std::string in) {

View File

@@ -6,12 +6,12 @@
#ifndef JSONTEST_H_INCLUDED
#define JSONTEST_H_INCLUDED
#include <deque>
#include <json/config.h>
#include <json/value.h>
#include <json/writer.h>
#include <stdio.h>
#include <deque>
#include <sstream>
#include <stdio.h>
#include <string>
// //////////////////////////////////////////////////////////////////
@@ -104,7 +104,7 @@ private:
const char* expr,
unsigned int nestingLevel);
static JSONCPP_STRING indentText(const JSONCPP_STRING& text,
const JSONCPP_STRING& indent);
const JSONCPP_STRING& indent);
typedef std::deque<Failure> Failures;
Failures failures_;
@@ -212,7 +212,7 @@ TestResult& checkStringEqual(TestResult& result,
#define JSONTEST_ASSERT(expr) \
if (expr) { \
} else \
result_->addFailure(__FILE__, __LINE__, #expr)
result_->addFailure(__FILE__, __LINE__, #expr)
/// \brief Asserts that the given predicate is true.
/// The predicate may do other assertions and be a member function of the
@@ -231,21 +231,14 @@ TestResult& checkStringEqual(TestResult& result,
/// \brief Asserts that two values are equals.
#define JSONTEST_ASSERT_EQUAL(expected, actual) \
JsonTest::checkEqual(*result_, \
expected, \
actual, \
__FILE__, \
__LINE__, \
JsonTest::checkEqual(*result_, expected, actual, __FILE__, __LINE__, \
#expected " == " #actual)
/// \brief Asserts that two values are equals.
#define JSONTEST_ASSERT_STRING_EQUAL(expected, actual) \
JsonTest::checkStringEqual(*result_, \
JsonTest::ToJsonString(expected), \
JsonTest::ToJsonString(actual), \
__FILE__, \
__LINE__, \
#expected " == " #actual)
JsonTest::checkStringEqual(*result_, JsonTest::ToJsonString(expected), \
JsonTest::ToJsonString(actual), __FILE__, \
__LINE__, #expected " == " #actual)
/// \brief Asserts that a given expression throws an exception
#define JSONTEST_ASSERT_THROWS(expr) \
@@ -253,13 +246,12 @@ TestResult& checkStringEqual(TestResult& result,
bool _threw = false; \
try { \
expr; \
} \
catch (...) { \
} catch (...) { \
_threw = true; \
} \
if (!_threw) \
result_->addFailure( \
__FILE__, __LINE__, "expected exception thrown: " #expr); \
result_->addFailure(__FILE__, __LINE__, \
"expected exception thrown: " #expr); \
}
/// \brief Begin a fixture test case.
@@ -270,9 +262,11 @@ TestResult& checkStringEqual(TestResult& result,
return new Test##FixtureType##name(); \
} \
\
public: /* overridden from TestCase */ \
const char* testName() const JSONCPP_OVERRIDE { return #FixtureType "/" #name; } \
void runTestCase() JSONCPP_OVERRIDE; \
public: /* overridden from TestCase */ \
const char* testName() const JSONCPP_OVERRIDE { \
return #FixtureType "/" #name; \
} \
void runTestCase() JSONCPP_OVERRIDE; \
}; \
\
void Test##FixtureType##name::runTestCase()

File diff suppressed because it is too large Load Diff