osrm-backend/unit_tests/library/equal_json.hpp

28 lines
683 B
C++
Raw Normal View History

2016-03-24 16:02:55 -04:00
#ifndef UNIT_TESTS_JSON_EQUAL
#define UNIT_TESTS_JSON_EQUAL
#include <boost/test/included/unit_test.hpp>
#include "util/json_deep_compare.hpp"
boost::test_tools::predicate_result compareJSON(const osrm::util::json::Value &reference,
const osrm::util::json::Value &result)
{
std::string reason;
auto is_same = osrm::util::json::compare(reference, result, reason);
if (!is_same)
{
boost::test_tools::predicate_result res(false);
res.message() << reason;
return res;
}
return true;
}
#define CHECK_EQUAL_JSON(reference, result) BOOST_CHECK(compareJSON(reference, result));
#endif