Updated jansson test

This commit is contained in:
Alex Zolotarev 2011-05-19 03:45:39 +02:00 committed by Alex Zolotarev
parent c5165f3aa8
commit 8311b938e3

View file

@ -4,8 +4,11 @@
UNIT_TEST(Jansson_Smoke)
{
char const * str = "{\"location\":{\"latitude\":47.383333,\"longitude\":8.533333,"
"\"accuracy\":18000.0},\"access_token\":\"2:6aOjM2IAoPMaweWN:txhu5LpkRkLVb3u3\"}";
// char const * str = "{\"location\":{\"latitude\":47.383333,\"longitude\":8.533333,"
// "\"accuracy\":18000.0},\"access_token\":\"2:6aOjM2IAoPMaweWN:txhu5LpkRkLVb3u3\"}";
char const * str = "{\"location\":{\"latitude\":47.3345141,\"longitude\":8.5312839,"
"\"accuracy\":22.0},\"access_token\":\"2:vC65Xv0mxMtsNVf4:hY5YSIkuFfnAU77z\"}";
my::Json root(str);
TEST(json_is_object(root), ());
@ -14,15 +17,15 @@ UNIT_TEST(Jansson_Smoke)
json_t * lat = json_object_get(location, "latitude");
TEST(json_is_real(lat), ());
TEST_ALMOST_EQUAL(json_real_value(lat), 47.383333, ());
TEST_ALMOST_EQUAL(json_real_value(lat), 47.3345141, ());
json_t * lon = json_object_get(location, "longitude");
TEST(json_is_real(lon), ());
TEST_ALMOST_EQUAL(json_real_value(lon), 8.533333, ());
TEST_ALMOST_EQUAL(json_real_value(lon), 8.5312839, ());
json_t * acc = json_object_get(location, "accuracy");
TEST(json_is_real(acc), ());
TEST_ALMOST_EQUAL(json_real_value(acc), 18000.0, ());
TEST_ALMOST_EQUAL(json_real_value(acc), 22.0, ());
bool wasException = false;
try