From d908a2657e67f436f8158436d69c496aab94bdaa Mon Sep 17 00:00:00 2001 From: ipknHama Date: Thu, 17 Apr 2014 22:32:21 +0900 Subject: preparing JSON library for flask++; complete writing feature --- unittest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'unittest.cpp') diff --git a/unittest.cpp b/unittest.cpp index c0a45b7..48798d0 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -3,6 +3,7 @@ #include "routing.h" #include "utility.h" #include "flask.h" +#include "json.h" using namespace std; using namespace flask; @@ -235,6 +236,19 @@ TEST(multi_server) server2.stop(); } +TEST(json_write) +{ + json::wvalue x; + x["message"] = "hello world"; + ASSERT_EQUAL(R"({"message":"hello world"})", json::encode(x)); + + json::wvalue y; + y["scores"][0] = 1; + y["scores"][1] = "king"; + y["scores"][2] = 3.5; + ASSERT_EQUAL(R"({"scores":[1,"king",3.5]})", json::encode(y)); +} + int testmain() { bool failed = false; -- cgit v1.2.3-54-g00ecf