add test
This commit is contained in:
parent
d871e20202
commit
bc6a4d8065
23
unit_tests/util/json_render.cpp
Normal file
23
unit_tests/util/json_render.cpp
Normal 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()
|
||||
Loading…
Reference in New Issue
Block a user