From d362a07239e9ba4a338519c7536410c266d4e1c5 Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 16 Nov 2016 22:49:16 +0100 Subject: [PATCH] :green_heart: moved sample.json to standard test suite to run it with Valgrind --- test/src/unit-msgpack.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/test/src/unit-msgpack.cpp b/test/src/unit-msgpack.cpp index 3424c3fba..59268cfe5 100644 --- a/test/src/unit-msgpack.cpp +++ b/test/src/unit-msgpack.cpp @@ -612,6 +612,31 @@ TEST_CASE("MessagePack") } } + +// use this testcase outside [hide] to run it with Valgrind +TEST_CASE("single MessagePack roundtrip") +{ + SECTION("sample.json") + { + std::string filename = "test/data/json_testsuite/sample.json"; + + // parse JSON file + std::ifstream f_json(filename); + json j1 = json::parse(f_json); + + // parse MessagePack file + std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary); + std::vector packed((std::istreambuf_iterator(f_msgpack)), + std::istreambuf_iterator()); + json j2; + CHECK_NOTHROW(j2 = json::from_msgpack(packed)); + + // compare parsed JSON values + CHECK(j1 == j2); + } +} + + TEST_CASE("MessagePack roundtrips", "[hide]") { SECTION("input from msgpack-python") @@ -656,7 +681,7 @@ TEST_CASE("MessagePack roundtrips", "[hide]") "test/data/json_roundtrip/roundtrip30.json", "test/data/json_roundtrip/roundtrip31.json", "test/data/json_roundtrip/roundtrip32.json", -// "test/data/json_testsuite/sample.json", + "test/data/json_testsuite/sample.json", // kills AppVeyor "test/data/json_tests/pass1.json", "test/data/json_tests/pass2.json", "test/data/json_tests/pass3.json",