Apply clang-format

This commit is contained in:
Martchus 2017-10-27 15:48:26 +02:00
parent 5b550bc33a
commit ef6a91076f
4 changed files with 14 additions and 27 deletions

View File

@ -34,7 +34,8 @@ inline void assertEqualityLinewise(const Iteratable &iteratable1, const Iteratab
}
}
if (!differentLines.empty()) {
CPPUNIT_ASSERT_EQUAL_MESSAGE("the following lines differ: " + ConversionUtilities::joinStrings(differentLines, ", "), iteratable1, iteratable2);
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"the following lines differ: " + ConversionUtilities::joinStrings(differentLines, ", "), iteratable1, iteratable2);
}
}

View File

@ -1,5 +1,5 @@
#include "./structs.h"
#include "./helper.h"
#include "./structs.h"
#include "../codefactory.h"
@ -126,8 +126,8 @@ void OverallTests::testSingleInheritence()
"{\"someInt\":42,\"someString\":\"the answer\",\"yetAnotherString\":\"but what was the question\",\"someBool\":false}");
// test serialization
CPPUNIT_ASSERT_EQUAL(expectedJSONForBase, string(static_cast<const JSONSerializable<TestStruct> &>(test).toJson().GetString()));
CPPUNIT_ASSERT_EQUAL(expectedJSONForDerived, string(static_cast<const JSONSerializable<DerivedTestStruct> &>(test).toJson().GetString()));
CPPUNIT_ASSERT_EQUAL(expectedJSONForBase, string(as<TestStruct>(test).toJson().GetString()));
CPPUNIT_ASSERT_EQUAL(expectedJSONForDerived, string(as<DerivedTestStruct>(test).toJson().GetString()));
// test deserialization
const DerivedTestStruct parsedTest(JSONSerializable<DerivedTestStruct>::fromJson(expectedJSONForDerived));
@ -152,7 +152,7 @@ void OverallTests::testMultipleInheritence()
"question\",\"arrayOfStrings\":[\"array\",\"of\",\"strings\"],\"someBool\":false}");
// test serialization
CPPUNIT_ASSERT_EQUAL(expectedJSONForDerived, string(static_cast<const JSONSerializable<MultipleDerivedTestStruct> &>(test).toJson().GetString()));
CPPUNIT_ASSERT_EQUAL(expectedJSONForDerived, string(as<MultipleDerivedTestStruct>(test).toJson().GetString()));
// test deserialization
const MultipleDerivedTestStruct parsedTest(JSONSerializable<MultipleDerivedTestStruct>::fromJson(expectedJSONForDerived));

View File

@ -23,7 +23,7 @@ template <typename Type,
void push(const Type &reflectable, RAPIDJSON_NAMESPACE::Value::Object &value, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
{
boost::hana::for_each(reflectable, [&value, &allocator](auto pair) {
push(boost::hana::second(pair), boost::hana::to<char const*>(boost::hana::first(pair)), value, allocator);
push(boost::hana::second(pair), boost::hana::to<char const *>(boost::hana::first(pair)), value, allocator);
});
}
@ -34,9 +34,8 @@ template <typename Type,
Traits::All<Traits::IsIteratable<Type>, Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string>>>>...>
void pull(Type &reflectable, RAPIDJSON_NAMESPACE::GenericValue<RAPIDJSON_NAMESPACE::UTF8<char>>::ValueIterator &value)
{
boost::hana::for_each(reflectable, [&value](auto pair) {
pull(boost::hana::second(pair), boost::hana::to<char const*>(boost::hana::first(pair)), value);
});
boost::hana::for_each(
reflectable, [&value](auto pair) { pull(boost::hana::second(pair), boost::hana::to<char const *>(boost::hana::first(pair)), value); });
}
template <typename Type,
@ -44,9 +43,8 @@ template <typename Type,
Traits::All<Traits::IsIteratable<Type>, Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string>>>>...>
void pull(Type &reflectable, const RAPIDJSON_NAMESPACE::GenericValue<RAPIDJSON_NAMESPACE::UTF8<char>>::ConstObject &value)
{
boost::hana::for_each(reflectable, [&value](auto pair) {
pull(boost::hana::second(pair), boost::hana::to<char const*>(boost::hana::first(pair)), value);
});
boost::hana::for_each(
reflectable, [&value](auto pair) { pull(boost::hana::second(pair), boost::hana::to<char const *>(boost::hana::first(pair)), value); });
}
} // namespace Reflector

View File

@ -31,27 +31,15 @@ using namespace ReflectiveRapidJSON;
// define some structs for testing serialization
struct TestObject : public JSONSerializable<TestObject> {
BOOST_HANA_DEFINE_STRUCT(TestObject,
(int, number),
(double, number2),
(vector<int>, numbers),
(string, text),
(bool, boolean)
);
BOOST_HANA_DEFINE_STRUCT(TestObject, (int, number), (double, number2), (vector<int>, numbers), (string, text), (bool, boolean));
};
struct NestingObject : public JSONSerializable<NestingObject> {
BOOST_HANA_DEFINE_STRUCT(NestingObject,
(string, name),
(TestObject, testObj)
);
BOOST_HANA_DEFINE_STRUCT(NestingObject, (string, name), (TestObject, testObj));
};
struct NestingArray : public JSONSerializable<NestingArray> {
BOOST_HANA_DEFINE_STRUCT(NestingArray,
(string, name),
(vector<TestObject>, testObjects)
);
BOOST_HANA_DEFINE_STRUCT(NestingArray, (string, name), (vector<TestObject>, testObjects));
};
/// \endcond