integrate jansson.hpp into build and test suite
[jansson.git] / test / suites / api / test_cpp.cpp
index d69c344..edcac77 100644 (file)
@@ -19,8 +19,8 @@
 #define ASSERT_TRUE(p, m) ASSERT_OP(p, true, ==, m)
 #define ASSERT_FALSE(p, m) ASSERT_OP(p, true, !=, m)
 
-int json_cpp_tests() {
-       json::Value e1(json::load_file("test.json"));
+int main() {
+       json::Value e1(json::load_file("suites/api/test.json"));
        json::Value e2(e1);
        json::Value e3;
        json::Value e4(json::load_string("{\"foo\": true, \"bar\": \"test\"}"));
@@ -126,7 +126,7 @@ int json_cpp_tests() {
        char* out_cstr = e12.save_string(0);
        std::string out(out_cstr);
        free(out_cstr);
-       ASSERT_EQ(out, "{\"bar\": 3,\"foo\": \"test\"}\n", "object did not serialize as expected");
+       ASSERT_EQ(out, "{\"bar\": 3, \"foo\": \"test\"}", "object did not serialize as expected");
 
        std::istringstream instr(out);
        instr >> e12;
@@ -137,7 +137,7 @@ int json_cpp_tests() {
 
        std::ostringstream outstr;
        outstr << e12;
-       ASSERT_EQ(instr.str(), "{\"bar\": 3,\"foo\": \"test\"}\n", "object did not serialize as expected");
+       ASSERT_EQ(instr.str(), "{\"bar\": 3, \"foo\": \"test\"}", "object did not serialize as expected");
 
        const json::Value e13(e12);
        ASSERT_EQ(e13["bar"].as_integer(), 3, "e13.bar has incorrect value after copy");