UniValue: fix major bug, add unit tests#4730
Conversation
src/test/univalue_tests.cpp
Outdated
There was a problem hiding this comment.
I'd write this as CHECK(numTest.SetNumStr("82"));
273e952 to
e85267b
Compare
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4730_dc271fc025d219c18428a4d36dbc372c8e457908/ for binaries and test log. |
|
ut ACK. |
There was a problem hiding this comment.
It seems most of these checks assume pretty sane input. It'd be nice to see some exotic and/or blatantly wrong set's here, in order to test that they work or fail as anticipated.
for ex:
setInt(INT_MAX+1LL);
setNumStr("-2147483647")
setNumStr("1.1");
setStr("2") && isStr()/isNum()
etc.
For those, I really don't know what the expected results would be, so I suppose it'd serve as some poor-man's documentation as well.
2862b56 [tests] remove redundant univalue_tests.cpp (John Newbery) Pull request description: univalue unit tests were added in #4730 , and exist at `/src/test/univalue_tests.cpp` (outside the univalue tree). That test was brought into the univalue repository in bitcoin-core/univalue-subtree#4 , which was pulled into the github repository in #11420. That means that the univalue test exists in two places: 1. `/src/test/univalue_tests.cpp` 2. `/src/univalue/test/object.cpp` (2) is a strict superset of (1). It adds some macros to work around boost not being a univalue dependency, and adds a few extra lines of test. Therefore remove `/src/test/univalue_tests.cpp` Tree-SHA512: 3747b10bbf62e9f12363905488b29945ad559ddca68c5c03d8a362de612a51f408f41a04d3712c6889bfc1632fb1a5fa0d7df0fbf02c322b3981a6d698f501b0
2862b56 [tests] remove redundant univalue_tests.cpp (John Newbery) Pull request description: univalue unit tests were added in dashpay#4730 , and exist at `/src/test/univalue_tests.cpp` (outside the univalue tree). That test was brought into the univalue repository in bitcoin-core/univalue-subtree#4 , which was pulled into the github repository in bitcoin#11420. That means that the univalue test exists in two places: 1. `/src/test/univalue_tests.cpp` 2. `/src/univalue/test/object.cpp` (2) is a strict superset of (1). It adds some macros to work around boost not being a univalue dependency, and adds a few extra lines of test. Therefore remove `/src/test/univalue_tests.cpp` Tree-SHA512: 3747b10bbf62e9f12363905488b29945ad559ddca68c5c03d8a362de612a51f408f41a04d3712c6889bfc1632fb1a5fa0d7df0fbf02c322b3981a6d698f501b0
All numbers were broken, due to lack of an underscore. No wonder my all-tree conversion to UniValue was failing its tests.