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

@ -5,82 +5,69 @@
using namespace ArduinoJson::Internals;
class QuotedString_PrintTo_Tests : public testing::Test
{
class QuotedString_PrintTo_Tests : public testing::Test {
protected:
void whenInputIs(const char* input)
{
StringBuilder sb(buffer, sizeof(buffer));
returnValue = QuotedString::printTo(input, &sb);
}
void whenInputIs(const char *input) {
StringBuilder sb(buffer, sizeof(buffer));
returnValue = QuotedString::printTo(input, &sb);
}
void outputMustBe(const char* expected)
{
EXPECT_STREQ(expected, buffer);
EXPECT_EQ(strlen(expected), returnValue);
}
void outputMustBe(const char *expected) {
EXPECT_STREQ(expected, buffer);
EXPECT_EQ(strlen(expected), returnValue);
}
private:
char buffer[1024];
size_t returnValue;
char buffer[1024];
size_t returnValue;
};
TEST_F(QuotedString_PrintTo_Tests, Null)
{
whenInputIs(0);
outputMustBe("null");
TEST_F(QuotedString_PrintTo_Tests, Null) {
whenInputIs(0);
outputMustBe("null");
}
TEST_F(QuotedString_PrintTo_Tests, EmptyString)
{
whenInputIs("");
outputMustBe("\"\"");
TEST_F(QuotedString_PrintTo_Tests, EmptyString) {
whenInputIs("");
outputMustBe("\"\"");
}
TEST_F(QuotedString_PrintTo_Tests, QuotationMark)
{
whenInputIs("\"");
outputMustBe("\"\\\"\"");
TEST_F(QuotedString_PrintTo_Tests, QuotationMark) {
whenInputIs("\"");
outputMustBe("\"\\\"\"");
}
TEST_F(QuotedString_PrintTo_Tests, ReverseSolidus)
{
whenInputIs("\\");
outputMustBe("\"\\\\\"");
TEST_F(QuotedString_PrintTo_Tests, ReverseSolidus) {
whenInputIs("\\");
outputMustBe("\"\\\\\"");
}
TEST_F(QuotedString_PrintTo_Tests, Solidus)
{
whenInputIs("/");
outputMustBe("\"/\""); // but the JSON format allows \/
TEST_F(QuotedString_PrintTo_Tests, Solidus) {
whenInputIs("/");
outputMustBe("\"/\""); // but the JSON format allows \/
}
TEST_F(QuotedString_PrintTo_Tests, Backspace)
{
whenInputIs("\b");
outputMustBe("\"\\b\"");
TEST_F(QuotedString_PrintTo_Tests, Backspace) {
whenInputIs("\b");
outputMustBe("\"\\b\"");
}
TEST_F(QuotedString_PrintTo_Tests, Formfeed)
{
whenInputIs("\f");
outputMustBe("\"\\f\"");
TEST_F(QuotedString_PrintTo_Tests, Formfeed) {
whenInputIs("\f");
outputMustBe("\"\\f\"");
}
TEST_F(QuotedString_PrintTo_Tests, Newline)
{
whenInputIs("\n");
outputMustBe("\"\\n\"");
TEST_F(QuotedString_PrintTo_Tests, Newline) {
whenInputIs("\n");
outputMustBe("\"\\n\"");
}
TEST_F(QuotedString_PrintTo_Tests, CarriageReturn)
{
whenInputIs("\r");
outputMustBe("\"\\r\"");
TEST_F(QuotedString_PrintTo_Tests, CarriageReturn) {
whenInputIs("\r");
outputMustBe("\"\\r\"");
}
TEST_F(QuotedString_PrintTo_Tests, HorizontalTab)
{
whenInputIs("\t");
outputMustBe("\"\\t\"");
TEST_F(QuotedString_PrintTo_Tests, HorizontalTab) {
whenInputIs("\t");
outputMustBe("\"\\t\"");
}