From c9b33e33867ca101b50d54f36057463ca353ec29 Mon Sep 17 00:00:00 2001 From: Sean Middleditch Date: Mon, 18 Jan 2010 21:36:02 -0800 Subject: [PATCH] integrate jansson.hpp into build and test suite --- configure.ac | 1 + src/Makefile.am | 2 +- test/.gitignore | 1 + test/suites/api/Makefile.am | 4 +++- test/suites/api/test_cpp.cpp | 8 ++++---- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index d28a5e4..43ce1d0 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,7 @@ AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CC +AC_PROG_CXX AC_PROG_LIBTOOL # Checks for libraries. diff --git a/src/Makefile.am b/src/Makefile.am index 87123a0..d5c20e8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -include_HEADERS = jansson.h +include_HEADERS = jansson.h jansson.hpp jansson-impl.hpp lib_LTLIBRARIES = libjansson.la libjansson_la_SOURCES = \ diff --git a/test/.gitignore b/test/.gitignore index a960c50..065b4ea 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -7,3 +7,4 @@ suites/api/test_load suites/api/test_number suites/api/test_object suites/api/test_simple +suites/api/test_cpp diff --git a/test/suites/api/Makefile.am b/test/suites/api/Makefile.am index 772f75a..35f1ee0 100644 --- a/test/suites/api/Makefile.am +++ b/test/suites/api/Makefile.am @@ -5,7 +5,8 @@ check_PROGRAMS = \ test_load \ test_simple \ test_number \ - test_object + test_object \ + test_cpp test_array_SOURCES = test_array.c util.h test_copy_SOURCES = test_copy.c util.h @@ -13,6 +14,7 @@ test_load_SOURCES = test_load.c util.h test_simple_SOURCES = test_simple.c util.h test_number_SOURCES = test_number.c util.h test_object_SOURCES = test_object.c util.h +test_cpp_SOURCES = test_cpp.cpp AM_CPPFLAGS = -I$(top_srcdir)/src AM_CFLAGS = -Wall -Werror diff --git a/test/suites/api/test_cpp.cpp b/test/suites/api/test_cpp.cpp index d69c344..edcac77 100644 --- a/test/suites/api/test_cpp.cpp +++ b/test/suites/api/test_cpp.cpp @@ -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"); -- 2.1.4