This commit is contained in:
Siarhei Fedartsou 2022-10-01 15:11:20 +02:00
parent d871e20202
commit bc6a4d8065

View File

@ -0,0 +1,23 @@
#include "util/json_container.hpp"
#include "util/json_renderer.hpp"
#include <boost/test/unit_test.hpp>
#include <iostream>
BOOST_AUTO_TEST_SUITE(json_renderer)
using namespace osrm;
using namespace osrm::util;
BOOST_AUTO_TEST_CASE(number_truncating)
{
std::string str;
json::Renderer<std::string> renderer(str);
// this number would have more than 10 decimals if not truncated
renderer(json::Number{42.9995999594999399299});
BOOST_CHECK_EQUAL(str, "42.999599959");
}
BOOST_AUTO_TEST_SUITE_END()