Skip to content

Commit 38f9c40

Browse files
committed
Apply code formatting
1 parent 0052c4f commit 38f9c40

2 files changed

Lines changed: 37 additions & 38 deletions

File tree

tests/UnitTest/JsonFormatTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ namespace JsonFormat
169169
std::unordered_map<std::string, std::string> testData {
170170
{R"({"NaN":NaN})", "{\r\n \"NaN\": NaN\r\n}"},
171171
{R"({"Mixed":[null,null,"power"]})", "{\r\n \"Mixed\": [\r\n null,\r\n null,\r\n \"power\"\r\n ]\r\n}"},
172-
{R"({"Inf":[-Infinity, Infinity, -Inf, Inf]})",
173-
"{\r\n \"Inf\": [\r\n -Infinity,\r\n Infinity,\r\n -Inf,\r\n Inf\r\n ]\r\n}"},
172+
{R"({"Inf":[-Infinity, Infinity, -Inf, Inf]})", "{\r\n \"Inf\": [\r\n -Infinity,\r\n Infinity,\r\n -Inf,\r\n Inf\r\n ]\r\n}"},
174173
};
175174

176175
LE lineEndingOption = rj::kCrLf; // Windows line ending

tests/UnitTest/JsonSortByKeyTest.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -142,52 +142,52 @@ namespace JsonSortByKey
142142
auto result = m_jsonHandler.SortJsonByKey(inputJson, {}, {}, ' ', 2);
143143

144144
ASSERT_TRUE(result.success);
145-
ASSERT_EQ(result.response, "{\n \"big\": 12345678901234567890,\n \"pi\": 3.141592653589793238,\n \"tiny\": 1e-14,\n \"tiny2\": 0.00000000000001,\n \"z\": \"last\"\n}");
145+
ASSERT_EQ(
146+
result.response,
147+
"{\n \"big\": 12345678901234567890,\n \"pi\": 3.141592653589793238,\n \"tiny\": 1e-14,\n \"tiny2\": 0.00000000000001,\n \"z\": \"last\"\n}");
146148
}
147149

148150
TEST_F(JsonSortByKeyTest, TestSortJsonByKey_NumberFormats_Success)
149151
{
150152
// Verify all valid JSON number notations survive sort-by-key roundtrip exactly
151153
// (synced with RapidJSON's Document.RawNumberRoundtrip_NumberFormats test).
152-
std::string inputJson =
153-
R"({"neg_frac": -0.5,)"
154-
R"( "int": 42,)"
155-
R"( "neg": -17,)"
156-
R"( "zero": 0,)"
157-
R"( "frac": 3.14,)"
158-
R"( "exp_lower": 1e10,)"
159-
R"( "exp_upper": 1E10,)"
160-
R"( "exp_plus": 1e+10,)"
161-
R"( "exp_neg": 1e-10,)"
162-
R"( "exp_frac": 1.5e3,)"
163-
R"( "huge_int": 99999999999999999999,)"
164-
R"( "huge_neg": -99999999999999999999,)"
165-
R"( "tiny_exp": 1e-308,)"
166-
R"( "tiny_frac": 0.000000000000000001,)"
167-
R"( "leading_zero_frac": 0.123})";
168-
auto result = m_jsonHandler.SortJsonByKey(inputJson, {}, {}, ' ', 2);
154+
std::string inputJson = R"({"neg_frac": -0.5,)"
155+
R"( "int": 42,)"
156+
R"( "neg": -17,)"
157+
R"( "zero": 0,)"
158+
R"( "frac": 3.14,)"
159+
R"( "exp_lower": 1e10,)"
160+
R"( "exp_upper": 1E10,)"
161+
R"( "exp_plus": 1e+10,)"
162+
R"( "exp_neg": 1e-10,)"
163+
R"( "exp_frac": 1.5e3,)"
164+
R"( "huge_int": 99999999999999999999,)"
165+
R"( "huge_neg": -99999999999999999999,)"
166+
R"( "tiny_exp": 1e-308,)"
167+
R"( "tiny_frac": 0.000000000000000001,)"
168+
R"( "leading_zero_frac": 0.123})";
169+
auto result = m_jsonHandler.SortJsonByKey(inputJson, {}, {}, ' ', 2);
169170

170171
ASSERT_TRUE(result.success);
171172

172173
// Verify exact output with alphabetically sorted keys and preserved number text
173-
std::string expected =
174-
"{\n"
175-
" \"exp_frac\": 1.5e3,\n"
176-
" \"exp_lower\": 1e10,\n"
177-
" \"exp_neg\": 1e-10,\n"
178-
" \"exp_plus\": 1e+10,\n"
179-
" \"exp_upper\": 1E10,\n"
180-
" \"frac\": 3.14,\n"
181-
" \"huge_int\": 99999999999999999999,\n"
182-
" \"huge_neg\": -99999999999999999999,\n"
183-
" \"int\": 42,\n"
184-
" \"leading_zero_frac\": 0.123,\n"
185-
" \"neg\": -17,\n"
186-
" \"neg_frac\": -0.5,\n"
187-
" \"tiny_exp\": 1e-308,\n"
188-
" \"tiny_frac\": 0.000000000000000001,\n"
189-
" \"zero\": 0\n"
190-
"}";
174+
std::string expected = "{\n"
175+
" \"exp_frac\": 1.5e3,\n"
176+
" \"exp_lower\": 1e10,\n"
177+
" \"exp_neg\": 1e-10,\n"
178+
" \"exp_plus\": 1e+10,\n"
179+
" \"exp_upper\": 1E10,\n"
180+
" \"frac\": 3.14,\n"
181+
" \"huge_int\": 99999999999999999999,\n"
182+
" \"huge_neg\": -99999999999999999999,\n"
183+
" \"int\": 42,\n"
184+
" \"leading_zero_frac\": 0.123,\n"
185+
" \"neg\": -17,\n"
186+
" \"neg_frac\": -0.5,\n"
187+
" \"tiny_exp\": 1e-308,\n"
188+
" \"tiny_frac\": 0.000000000000000001,\n"
189+
" \"zero\": 0\n"
190+
"}";
191191
ASSERT_EQ(result.response, expected);
192192
}
193193
} // namespace JsonSortByKey

0 commit comments

Comments
 (0)