add test
This commit is contained in:
parent
ae157de5d0
commit
6a5b3f448b
@ -7,24 +7,23 @@
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(json_renderer)
|
BOOST_AUTO_TEST_SUITE(json_renderer)
|
||||||
|
|
||||||
using namespace osrm;
|
using namespace osrm::util::json;
|
||||||
using namespace osrm::util;
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(number_truncating)
|
BOOST_AUTO_TEST_CASE(number_truncating)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
json::Renderer<std::string> renderer(str);
|
Renderer<std::string> renderer(str);
|
||||||
|
|
||||||
// this number would have more than 10 decimals if not truncated
|
// this number would have more than 10 decimals if not truncated
|
||||||
renderer(json::Number{42.9995999594999399299});
|
renderer(Number{42.9995999594999399299});
|
||||||
BOOST_CHECK_EQUAL(str, "42.999599959");
|
BOOST_CHECK_EQUAL(str, "42.999599959");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(integer)
|
BOOST_AUTO_TEST_CASE(integer)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
json::Renderer<std::string> renderer(str);
|
Renderer<std::string> renderer(str);
|
||||||
renderer(json::Number{42.0});
|
renderer(Number{42.0});
|
||||||
BOOST_CHECK_EQUAL(str, "42");
|
BOOST_CHECK_EQUAL(str, "42");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user