UniValue: fix major bug, add unit tests #4730
pull jgarzik wants to merge 4 commits into bitcoin:master from jgarzik:2014_univ_tests changing 4 files +285 −4-
jgarzik commented at 5:44 pm on August 19, 2014: contributorAll numbers were broken, due to lack of an underscore. No wonder my all-tree conversion to UniValue was failing its tests.
-
jgarzik added the label Bug on Aug 19, 2014
-
jgarzik added the label Improvement on Aug 19, 2014
-
jgarzik added the label Priority Low on Aug 19, 2014
-
jgarzik added the label Tests on Aug 19, 2014
-
jgarzik removed the label Priority Low on Aug 19, 2014
-
jgarzik added the label Priority Medium on Aug 19, 2014
-
UniValue: use correct setNumStr() input val, when setting number values 42642c9695
-
UniValue: compact (!pretty) output should not include extra whitespace dee9324a0b
-
UniValue: add unit tests e85267be63
-
in src/test/univalue_tests.cpp: in 0c4444a318 outdated
25+ UniValue v3(UniValue::VSTR, "foo"); 26+ BOOST_CHECK_EQUAL(v3.isStr(), true); 27+ BOOST_CHECK_EQUAL(v3.getValStr(), "foo"); 28+ 29+ UniValue numTest; 30+ bool rc = numTest.setNumStr("82");
sipa commented at 9:54 pm on August 19, 2014:I’d write this as CHECK(numTest.SetNumStr(“82”));jgarzik force-pushed on Aug 20, 2014UniValue tests: use more BOOST_CHECK() dc271fc025BitcoinPullTester commented at 5:22 am on August 20, 2014: noneAutomatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4730_dc271fc025d219c18428a4d36dbc372c8e457908/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.TheBlueMatt commented at 10:35 pm on August 20, 2014: memberut ACK.in src/test/univalue_tests.cpp: in dc271fc025
117+ 118+ BOOST_CHECK(!v.setNumStr("zombocom")); 119+ 120+ BOOST_CHECK(v.setNull()); 121+ BOOST_CHECK(v.isNull()); 122+}
theuni commented at 11:22 pm on August 20, 2014: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.
in src/test/univalue_tests.cpp: in dc271fc025
113+ BOOST_CHECK_EQUAL(v.isBool(), true); 114+ BOOST_CHECK_EQUAL(v.isTrue(), true); 115+ BOOST_CHECK_EQUAL(v.isFalse(), false); 116+ BOOST_CHECK_EQUAL(v.getBool(), true); 117+ 118+ BOOST_CHECK(!v.setNumStr("zombocom"));
sipa commented at 11:27 pm on August 20, 2014:welcome to zombocom!jgarzik merged this on Aug 21, 2014jgarzik closed this on Aug 21, 2014
jgarzik referenced this in commit f368af3d5d on Aug 21, 2014jgarzik deleted the branch on Aug 24, 2014laanwj referenced this in commit d4e404a3af on Dec 20, 2017PastaPastaPasta referenced this in commit b53223581d on Jan 17, 2020PastaPastaPasta referenced this in commit 690189b9d2 on Jan 22, 2020PastaPastaPasta referenced this in commit 332b024009 on Jan 22, 2020PastaPastaPasta referenced this in commit d49f484027 on Jan 29, 2020PastaPastaPasta referenced this in commit e5a8e6f4ea on Jan 29, 2020PastaPastaPasta referenced this in commit f5ea528ecc on Jan 29, 2020PastaPastaPasta referenced this in commit 3654f15c91 on Jan 31, 2020ckti referenced this in commit 735b2f2543 on Mar 28, 2021MarcoFalke locked this on Sep 8, 2021
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 18:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me