14 #include <string_view> 17 #define BOOST_CHECK(expr) assert(expr) 18 #define BOOST_CHECK_EQUAL(v1, v2) assert((v1) == (v2)) 19 #define BOOST_CHECK_THROW(stmt, excMatch) { \ 22 assert(0 && "No exception caught"); \ 23 } catch (excMatch & e) { \ 25 assert(0 && "Wrong exception caught"); \ 28 #define BOOST_CHECK_NO_THROW(stmt) { \ 73 std::string vs(
"yawn");
78 const char *vcs =
"zappa";
135 std::vector<UniValue> vals = v5.getValues();
165 std::string_view sv{
"ab\0c", 4};
180 v.
setInt(int64_t{-1023LL});
184 v.
setInt(uint64_t{1023ULL});
217 std::string vStr(
"zippy");
220 const char *s =
"pippy";
223 std::vector<UniValue> vec;
272 std::string strKey, strVal;
281 obj.
pushKV(strKey, strVal);
284 const char* cVal =
"Smith";
288 obj.
pushKV(strKey, int64_t{25});
291 obj.
pushKV(strKey, uint64_t{3600});
294 obj.
pushKV(strKey,
int{12});
296 strKey =
"temperature";
297 obj.
pushKV(strKey,
double{90.012});
303 obj.
pushKV(strKey,
false);
306 obj2.
pushKV(
"cat1", 9000);
307 obj2.
pushKV(
"cat2", 12345);
342 std::map<std::string, UniValue::VType> objTypes;
376 obj.
pushKV(
"name",
"foo bar");
378 std::map<std::string,UniValue> kv;
386 "[1.10000000,{\"key1\":\"str\\u0000\",\"key2\":800,\"key3\":{\"name\":\"martian http://test.com\"}}]";
393 std::string strJson1(
json1);
406 std::string correctValue(
"str");
407 correctValue.push_back(
'\0');
458 int main(
int argc,
char* argv[])
void push_back(UniValue val)
const std::vector< UniValue > & getValues() const
void univalue_readwrite()
#define BOOST_CHECK_THROW(stmt, excMatch)
int main(int argc, char *argv[])
void pushKVs(UniValue obj)
bool read(std::string_view raw)
const std::string & get_str() const
void pushKVEnd(std::string key, UniValue val)
enum VType getType() const
const UniValue & get_array() const
const std::vector< std::string > & getKeys() const
const std::string & getValStr() const
static const char * json1
void getObjMap(std::map< std::string, UniValue > &kv) const
bool exists(const std::string &key) const
void univalue_constructor()
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
void push_backV(const std::vector< UniValue > &vec)
bool checkObject(const std::map< std::string, UniValue::VType > &memberTypes) const
void setNumStr(std::string str)
#define BOOST_CHECK_EQUAL(v1, v2)
void univalue_typecheck()
void pushKV(std::string key, UniValue val)
const UniValue & get_obj() const
#define BOOST_CHECK_NO_THROW(stmt)
void univalue_push_throw()
void setFloat(double val)
void setInt(uint64_t val)
void setStr(std::string str)
#define BOOST_CHECK(expr)