diff options
author | ipknHama <ipknhama@gmail.com> | 2014-04-17 22:32:21 +0900 |
---|---|---|
committer | ipknHama <ipknhama@gmail.com> | 2014-04-17 22:32:50 +0900 |
commit | d908a2657e67f436f8158436d69c496aab94bdaa (patch) | |
tree | 8459259b955fbda45c9f903c1fd98e7ea7b18809 /unittest.cpp | |
parent | af6bc11fb4360ca8a1f244283e51065ee38ffc80 (diff) | |
download | crow-d908a2657e67f436f8158436d69c496aab94bdaa.tar.gz crow-d908a2657e67f436f8158436d69c496aab94bdaa.zip |
preparing JSON library for flask++; complete writing feature
Diffstat (limited to 'unittest.cpp')
-rw-r--r-- | unittest.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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; |