TEST_F(JsonArray_PrintTo_Tests, OneStringOverCapacity) { array.add("hello"); array.add("world"); array.add("lost"); outputMustBe("[\"hello\",\"world\"]"); }
TEST_F(JsonArray_PrintTo_Tests, OneBooleanOverCapacity) { array.add(false); array.add(true); array.add(false); outputMustBe("[false,true]"); }
TEST_F(JsonArray_PrintTo_Tests, OneIntegerOverCapacity) { array.add(1); array.add(2); array.add(3); outputMustBe("[1,2]"); }
TEST_F(JsonObject_PrettyPrintTo_Tests, OneMember) { _object["key"] = "value"; outputMustBe( "{\r\n" " \"key\": \"value\"\r\n" "}"); }
TEST_F(JsonArray_PrettyPrintTo_Tests, OneElement) { array.add(1); outputMustBe( "[\r\n" " 1\r\n" "]"); }
TEST_F(JsonArray_PrettyPrintTo_Tests, TwoElements) { array.add(1); array.add(2); outputMustBe( "[\r\n" " 1,\r\n" " 2\r\n" "]"); }
TEST_F(JsonObject_PrettyPrintTo_Tests, TwoMembers) { _object["key1"] = "value1"; _object["key2"] = "value2"; outputMustBe( "{\r\n" " \"key1\": \"value1\",\r\n" " \"key2\": \"value2\"\r\n" "}"); }
TEST_F(JsonObject_PrettyPrintTo_Tests, EmptyNestedContainers) { _object.createNestedObject("key1"); _object.createNestedArray("key2"); outputMustBe( "{\r\n" " \"key1\": {},\r\n" " \"key2\": []\r\n" "}"); }
TEST_F(JsonArray_PrettyPrintTo_Tests, EmptyNestedArrays) { array.createNestedArray(); array.createNestedArray(); outputMustBe( "[\r\n" " [],\r\n" " []\r\n" "]"); }
TEST_F(JsonObject_PrettyPrintTo_Tests, NestedContainers) { JsonObject &nested1 = _object.createNestedObject("key1"); nested1["a"] = 1; JsonArray &nested2 = _object.createNestedArray("key2"); nested2.add(2); outputMustBe( "{\r\n" " \"key1\": {\r\n" " \"a\": 1\r\n" " },\r\n" " \"key2\": [\r\n" " 2\r\n" " ]\r\n" "}"); }
TEST_F(JsonArray_PrettyPrintTo_Tests, NestedArrays) { JsonArray& nested1 = array.createNestedArray(); nested1.add(1); nested1.add(2); JsonObject& nested2 = array.createNestedObject(); nested2["key"] = 3; outputMustBe( "[\r\n" " [\r\n" " 1,\r\n" " 2\r\n" " ],\r\n" " {\r\n" " \"key\": 3\r\n" " }\r\n" "]"); }
TEST_F(JsonObject_PrettyPrintTo_Tests, EmptyObject) { outputMustBe("{}"); }
TEST_F(JsonArray_PrintTo_Tests, TwoIntegers) { array.add(1); array.add(2); outputMustBe("[1,2]"); }
TEST_F(JsonArray_PrintTo_Tests, OneInteger) { array.add(1); outputMustBe("[1]"); }
TEST_F(JsonArray_PrintTo_Tests, OneFloatFourDigits) { array.add(3.14159f, 4); outputMustBe("[3.1416]"); }
TEST_F(JsonArray_PrintTo_Tests, OneFloatDefaultDigits) { array.add(3.14159f); outputMustBe("[3.14]"); }
TEST_F(JsonArray_PrintTo_Tests, OneEmptyNestedArray) { array.createNestedArray(); outputMustBe("[[]]"); }
TEST_F(JsonArray_PrintTo_Tests, OneTrue) { array.add(true); outputMustBe("[true]"); }
TEST_F(JsonArray_PrintTo_Tests, OneDoubleDefaultDigits) { array.add(3.14159265358979323846); outputMustBe("[3.14]"); }
TEST_F(JsonArray_PrintTo_Tests, OneFalse) { array.add(false); outputMustBe("[false]"); }
TEST_F(JsonArray_PrintTo_Tests, TwoStrings) { array.add("hello"); array.add("world"); outputMustBe("[\"hello\",\"world\"]"); }
TEST_F(JsonArray_PrintTo_Tests, Null) { array.add(static_cast<char *>(0)); outputMustBe("[null]"); }
TEST_F(JsonArray_PrintTo_Tests, Empty) { outputMustBe("[]"); }
TEST_F(JsonArray_PrintTo_Tests, OneEmptyNestedHash) { array.createNestedObject(); outputMustBe("[{}]"); }
TEST_F(JsonArray_PrintTo_Tests, RawJson) { array.add(RawJson("{\"key\":\"value\"}")); outputMustBe("[{\"key\":\"value\"}]"); }
TEST_F(JsonArray_PrintTo_Tests, OneDoubleFourDigits) { array.add(3.14159265358979323846, 4); outputMustBe("[3.1416]"); }
TEST_F(JsonVariant_PrintTo_Tests, PositiveInt64) { variant = 9223372036854775807; outputMustBe("9223372036854775807"); }
TEST_F(JsonArray_PrintTo_Tests, OneDoubleFourDigits_AlternativeSyntax) { array.add(double_with_n_digits(3.14159265358979323846, 4)); outputMustBe("[3.1416]"); }
TEST_F(JsonArray_PrintTo_Tests, OneString) { array.add("hello"); outputMustBe("[\"hello\"]"); }
TEST_F(JsonArray_PrintTo_Tests, TwoBooleans) { array.add(false); array.add(true); outputMustBe("[false,true]"); }