Formated code with clang-format

This commit is contained in:
Benoit Blanchon
2014-10-23 19:54:00 +02:00
parent 888fdc1d54
commit 9175046f35
52 changed files with 2002 additions and 2638 deletions

View File

@ -4,118 +4,102 @@
using namespace ArduinoJson;
class JsonValueTests : public ::testing::Test
{
class JsonValueTests : public ::testing::Test {
protected:
virtual void SetUp()
{
jsonValue1 = json.createValue();
jsonValue2 = json.createValue();
}
virtual void SetUp() {
jsonValue1 = json.createValue();
jsonValue2 = json.createValue();
}
StaticJsonBuffer<42> json;
JsonValue jsonValue1;
JsonValue jsonValue2;
StaticJsonBuffer<42> json;
JsonValue jsonValue1;
JsonValue jsonValue2;
};
TEST_F(JsonValueTests, CanStoreInteger) {
jsonValue1 = 123;
TEST_F(JsonValueTests, CanStoreInteger)
{
jsonValue1 = 123;
EXPECT_EQ(123, (int) jsonValue1);
EXPECT_EQ(123, (int)jsonValue1);
}
TEST_F(JsonValueTests, CanStoreDouble)
{
jsonValue1 = 123.45;
TEST_F(JsonValueTests, CanStoreDouble) {
jsonValue1 = 123.45;
EXPECT_EQ(123.45, (double) jsonValue1);
EXPECT_EQ(123.45, (double)jsonValue1);
}
TEST_F(JsonValueTests, CanStoreTrue)
{
jsonValue1 = true;
EXPECT_TRUE((bool) jsonValue1);
TEST_F(JsonValueTests, CanStoreTrue) {
jsonValue1 = true;
EXPECT_TRUE((bool)jsonValue1);
}
TEST_F(JsonValueTests, CanStoreFalse)
{
jsonValue1 = false;
EXPECT_FALSE((bool) jsonValue1);
TEST_F(JsonValueTests, CanStoreFalse) {
jsonValue1 = false;
EXPECT_FALSE((bool)jsonValue1);
}
TEST_F(JsonValueTests, CanStoreString)
{
jsonValue1 = "hello";
EXPECT_STREQ("hello", (const char*) jsonValue1);
TEST_F(JsonValueTests, CanStoreString) {
jsonValue1 = "hello";
EXPECT_STREQ("hello", (const char *)jsonValue1);
}
TEST_F(JsonValueTests, CanStoreObject)
{
JsonObject innerObject1 = json.createObject();
TEST_F(JsonValueTests, CanStoreObject) {
JsonObject innerObject1 = json.createObject();
jsonValue1 = innerObject1;
jsonValue1 = innerObject1;
EXPECT_EQ(innerObject1, (JsonObject) jsonValue1);
EXPECT_EQ(innerObject1, (JsonObject)jsonValue1);
}
TEST_F(JsonValueTests, IntegersAreCopiedByValue)
{
jsonValue1 = 123;
jsonValue2 = jsonValue1;
jsonValue1 = 456;
TEST_F(JsonValueTests, IntegersAreCopiedByValue) {
jsonValue1 = 123;
jsonValue2 = jsonValue1;
jsonValue1 = 456;
EXPECT_EQ(123, (int) jsonValue2);
EXPECT_EQ(123, (int)jsonValue2);
}
TEST_F(JsonValueTests, DoublesAreCopiedByValue)
{
jsonValue1 = 123.45;
jsonValue2 = jsonValue1;
jsonValue1 = 456.78;
TEST_F(JsonValueTests, DoublesAreCopiedByValue) {
jsonValue1 = 123.45;
jsonValue2 = jsonValue1;
jsonValue1 = 456.78;
EXPECT_EQ(123.45, (double) jsonValue2);
EXPECT_EQ(123.45, (double)jsonValue2);
}
TEST_F(JsonValueTests, BooleansAreCopiedByValue)
{
jsonValue1 = true;
jsonValue2 = jsonValue1;
jsonValue1 = false;
TEST_F(JsonValueTests, BooleansAreCopiedByValue) {
jsonValue1 = true;
jsonValue2 = jsonValue1;
jsonValue1 = false;
EXPECT_TRUE((bool) jsonValue2);
EXPECT_TRUE((bool)jsonValue2);
}
TEST_F(JsonValueTests, StringsAreCopiedByValue)
{
jsonValue1 = "hello";
jsonValue2 = jsonValue1;
jsonValue1 = "world";
TEST_F(JsonValueTests, StringsAreCopiedByValue) {
jsonValue1 = "hello";
jsonValue2 = jsonValue1;
jsonValue1 = "world";
EXPECT_STREQ("hello", (const char*) jsonValue2);
EXPECT_STREQ("hello", (const char *)jsonValue2);
}
TEST_F(JsonValueTests, ObjectsAreCopiedByReference) {
JsonObject object = json.createObject();
TEST_F(JsonValueTests, ObjectsAreCopiedByReference)
{
JsonObject object = json.createObject();
jsonValue1 = object;
jsonValue1 = object;
object["hello"] = "world";
object["hello"] = "world";
EXPECT_EQ(1, ((JsonObject) jsonValue1).size());
EXPECT_EQ(1, ((JsonObject)jsonValue1).size());
}
TEST_F(JsonValueTests, ArraysAreCopiedByReference)
{
JsonArray array = json.createArray();
TEST_F(JsonValueTests, ArraysAreCopiedByReference) {
JsonArray array = json.createArray();
jsonValue1 = array;
array.add("world");
jsonValue1 = array;
EXPECT_EQ(1, ((JsonObject) jsonValue1).size());
array.add("world");
EXPECT_EQ(1, ((JsonObject)jsonValue1).size());
}