Bitcoin ABC
0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
src
univalue
test
test_json.cpp
Go to the documentation of this file.
1
// Test program that can be called by the JSON test suite at
2
// https://github.com/nst/JSONTestSuite.
3
//
4
// It reads JSON input from stdin and exits with code 0 if it can be parsed
5
// successfully. It also pretty prints the parsed JSON value to stdout.
6
7
#include <
univalue.h
>
8
9
#include <iostream>
10
#include <iterator>
11
#include <string>
12
13
using namespace
std
;
14
15
int
main
(
int
argc
,
char
*
argv
[]) {
16
UniValue
val;
17
if
(val.
read
(
string
(
istreambuf_iterator<char>
(
cin
),
18
istreambuf_iterator<char>
()))) {
19
cout
<< val.
write
(1
/* prettyIndent */
, 4
/* indentLevel */
) <<
endl
;
20
return
0;
21
}
else
{
22
cerr
<<
"JSON Parse Error."
<<
endl
;
23
return
1;
24
}
25
}
main
int main(void)
Definition
bench.c:157
UniValue
Definition
univalue.h:25
UniValue::write
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
Definition
univalue_write.cpp:159
UniValue::read
bool read(std::string_view raw)
Definition
univalue_read.cpp:287
std
Implement std::hash so RCUPtr can be used as a key for maps or sets.
Definition
rcu.h:259
GetRand
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition
random.h:85
univalue.h
Generated on Mon Nov 4 2024 02:38:12 for Bitcoin ABC by
1.9.8