@@ -16,7 +16,7 @@ namespace JsonFormat
1616 void SetUp () override {}
1717 void TearDown () override {}
1818
19- void setParseOptions (const ParseOptions & opt)
19+ void setParseOptions (const ParseOptions& opt)
2020 {
2121 m_jsonFormatter = JsonHandler (opt);
2222 }
@@ -178,7 +178,7 @@ namespace JsonFormat
178178 char indentChar = ' ' ;
179179 unsigned indentLen = 4 ; // No indentation
180180
181- for (const auto & [input, output] : testData)
181+ for (const auto & [input, output] : testData)
182182 {
183183 auto result = m_jsonFormatter.FormatJson (input, lineEndingOption, formatOptions, indentChar, indentLen);
184184
@@ -204,7 +204,7 @@ namespace JsonFormat
204204 char indentChar = ' ' ;
205205 unsigned indentLen = 4 ; // No indentation
206206
207- for (const auto & [input, output] : testData)
207+ for (const auto & [input, output] : testData)
208208 {
209209 auto result = m_jsonFormatter.FormatJson (input, lineEndingOption, formatOptions, indentChar, indentLen);
210210
@@ -242,7 +242,7 @@ namespace JsonFormat
242242 char indentChar = ' ' ; // space indented
243243 unsigned indentLen = 4 ; // No indentation
244244
245- std::unordered_map<std::string, std::string> testData {
245+ const std::unordered_map<std::string, std::string> testData {
246246 {R"( {"num": 12.148681171238422})" , " 12.148681171238422" }, // All good
247247 {R"( {"num": 42.835353759876654})" , " 42.835353759876654" }, // All good
248248 {R"( {"num": 5.107091491635510056019771245})" , " 5.10709149163551" }, // Fine: Rounded up
@@ -252,11 +252,41 @@ namespace JsonFormat
252252 {R"( {"num": -1722.1864265316147})" , " -1722.1864265316146" }, // This is interesting. Why last digit changed.
253253 {R"( {"num": -1722.1864265316148})" , " -1722.1864265316149" }, // This is interesting. Why last digit changed.
254254 {R"( {"num": -172345.18642653167979})" , " -172345.18642653167" }, // This is interesting. Why not rounded up.
255- {R"( {"num": 1.234e5})" , " 123400.0" }, // Don't know how to fix.
256- {R"( {"num": 0.0000001000})" , " 1e-7" }, // Don't know how to fix.
257- };
258-
259- for (const auto &[input, output] : testData)
255+ {R"( {"num": 1.234e5})" , " 123400.0" }, // -------------------------------------
256+ {R"( {"num": 0.0000001000})" , " 1e-7" }, // Don't know how to fix all the below.
257+ {R"( {"num":-5.0975200963490517E-33})" , " -5.097520096349052e-33" }, // -------------------------------------
258+ {R"( {"num":-6.3809366960906694E-48})" , " -6.38093669609067e-48" },
259+ {R"( {"num":-7.4034655373995265E-78})" , " -7.403465537399527e-78" },
260+ {R"( {"num":-7.7377839245507245E-78})" , " -7.737783924550725e-78" },
261+ {R"( {"num":1.2859736125485259E-22, })" , " 1.285973612548526e-22" },
262+ {R"( {"num":-3.5403485244736897E-88})" , " -3.54034852447369e-88" },
263+ {R"( {"num":-6553693.3617752995})" , " -6553693.3617752995" },
264+ {R"( {"num":-6.8141086401061905E-44})" , " -6.814108640106191e-44" },
265+ {R"( {"num":5.5843284390697506E-71})" , " 5.584328439069751e-71" },
266+ {R"( {"num":-4.3180528943019356E-77})" , " -4.318052894301936e-77" },
267+ {R"( {"num":-5.8231387142089446E-34})" , " -5.823138714208945e-34" },
268+ {R"( {"num":4.9686769279508796E-34})" , " 4.96867692795088e-34" },
269+ {R"( {"num":-1.7271559814272259E-77})" , " -1.727155981427226e-77" },
270+ {R"( {"num":-4.2596088775464085E-81})" , " -4.259608877546409e-81" },
271+ {R"( {"num":3.7049941506206046E-71})" , " 3.704994150620605e-71" },
272+ {R"( {"num":3.9742364030067576E-86})" , " 3.974236403006758e-86" },
273+ {R"( {"num":3.1628542535929037E-89})" , " 3.162854253592904e-89" },
274+ {R"( {"num":-268.52143589416397})" , " -268.521435894164" },
275+ {R"( {"num":-2.2795405986944148E-93})" , " -2.279540598694415e-93" },
276+ {R"( {"num":-7.3921473885461993E-95})" , " -7.3921473885462e-95" },
277+ {R"( {"num":-5.1970028999668327E-45})" , " -5.197002899966833e-45" },
278+ {R"( {"num":3.5937267475433058E-09})" , " 3.593726747543306e-9" },
279+ {R"( {"num":7.2781313854297585E-75})" , " 7.278131385429759e-75" },
280+ {R"( {"num":2.1823857766614118E-78})" , " 2.182385776661412e-78" },
281+ {R"( {"num":8.9080568887277594E-11})" , " 8.90805688872776e-11" },
282+ {R"( {"num":-898453.63759556494})" , " -898453.637595565" },
283+ {R"( {"num":-6.5029793100887976E-55})" , " -6.502979310088798e-55" },
284+ {R"( {"num":15650583.101212589})" , " 15650583.10121259" },
285+ {R"( {"num":-7.7306921203660293E-55})" , " -7.73069212036603e-55" },
286+ {R"( {"num":4.3436060211811726E-74})" , " 4.343606021181173e-74" },
287+ {R"( {"num":-7.1399486851522386E-90})" , " -7.139948685152239e-9" }};
288+
289+ for (const auto & [input, output] : testData)
260290 {
261291 auto result = m_jsonFormatter.FormatJson (input, lineEndingOption, formatOptions, indentChar, indentLen);
262292 bool foundNumber = result.response .find (output) != std::string::npos;
0 commit comments