integrate jansson.hpp into build and test suite

This commit is contained in:
Sean Middleditch
2010-01-18 21:36:02 -08:00
parent 2ad4634de5
commit c9b33e3386
5 changed files with 10 additions and 6 deletions

View 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");