From e2d83217609e6c5623f4ad28a26c10c0c07d8c5b Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 2 Oct 2018 11:23:59 +0200 Subject: [PATCH] Added JSON testing application --- CMakeLists.txt | 3 +++ test/json.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/json.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 50d74832..89ac6ca9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -705,4 +705,7 @@ add_test(LOGTest COMMAND urltest) add_executable(downloadertest test/downloader.cpp ${BINARY_DIR}/mist/.headers) target_link_libraries(downloadertest mist) add_test(DownloaderTest COMMAND downloadertest) +add_executable(jsontest test/json.cpp ${BINARY_DIR}/mist/.headers) +target_link_libraries(jsontest mist) +add_test(JSONTest COMMAND jsontest) diff --git a/test/json.cpp b/test/json.cpp new file mode 100644 index 00000000..e8695887 --- /dev/null +++ b/test/json.cpp @@ -0,0 +1,14 @@ +#include "../lib/json.cpp" +#include +#include +#include + +int main(int argc, char ** argv){ + std::string line; + std::stringstream jData; + while (getline(std::cin, line)){jData << line;} + JSON::Value J = JSON::fromString(jData.str().data(), jData.str().size()); + std::cout << J.toPrettyString() << std::endl; + return 0; +} +