Squashed 'src/univalue/' content from commit 9ef5b78

git-subtree-dir: src/univalue
git-subtree-split: 9ef5b78c1998509b8f1ccd76f0aee15140e384be
This commit is contained in:
Jack Grigg
2017-02-10 02:18:44 +00:00
commit a4071034f6
75 changed files with 2340 additions and 0 deletions

24
test/test_json.cpp Normal file
View File

@@ -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;
}
}