diff options
author | MarcoFalke <falke.marco@gmail.com> | 2017-09-29 14:31:36 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2017-09-29 14:35:46 +0200 |
commit | faaeeb0d3e777d991c7cfee983bea369c109f5cc (patch) | |
tree | c55d3d58f96acbbe9a4fc4ccd5b6f3a7e638a179 /src/univalue/test/test_json.cpp | |
parent | bbc901d3a683c92438a6b28dca50b956decc4433 (diff) | |
parent | 619bb05037a55c4b73973965989d199d8cb62f74 (diff) | |
download | bitcoin-faaeeb0d3e777d991c7cfee983bea369c109f5cc.tar.xz |
Bump univalue and fix json formatting in tests
This merge commit bumps the univalue subtree and also updates the whitespace
for some failing tests.
Diffstat (limited to 'src/univalue/test/test_json.cpp')
-rw-r--r-- | src/univalue/test/test_json.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/univalue/test/test_json.cpp b/src/univalue/test/test_json.cpp new file mode 100644 index 0000000000..2943bae2b1 --- /dev/null +++ b/src/univalue/test/test_json.cpp @@ -0,0 +1,24 @@ +// Test program that can be called by the JSON test suite at +// https://github.com/nst/JSONTestSuite. +// +// It reads JSON input from stdin and exits with code 0 if it can be parsed +// successfully. It also pretty prints the parsed JSON value to stdout. + +#include <iostream> +#include <string> +#include "univalue.h" + +using namespace std; + +int main (int argc, char *argv[]) +{ + UniValue val; + if (val.read(string(istreambuf_iterator<char>(cin), + istreambuf_iterator<char>()))) { + cout << val.write(1 /* prettyIndent */, 4 /* indentLevel */) << endl; + return 0; + } else { + cerr << "JSON Parse Error." << endl; + return 1; + } +} |