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
  1. jgarzik commented at 5:44 pm on August 19, 2014: contributor
    All numbers were broken, due to lack of an underscore. No wonder my all-tree conversion to UniValue was failing its tests.
  2. jgarzik added the label Bug on Aug 19, 2014
  3. jgarzik added the label Improvement on Aug 19, 2014
  4. jgarzik added the label Priority Low on Aug 19, 2014
  5. jgarzik added the label Tests on Aug 19, 2014
  6. jgarzik removed the label Priority Low on Aug 19, 2014
  7. jgarzik added the label Priority Medium on Aug 19, 2014
  8. UniValue: use correct setNumStr() input val, when setting number values 42642c9695
  9. UniValue: compact (!pretty) output should not include extra whitespace dee9324a0b
  10. UniValue: add unit tests e85267be63
  11. 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”));
  12. jgarzik force-pushed on Aug 20, 2014
  13. UniValue tests: use more BOOST_CHECK() dc271fc025
  14. BitcoinPullTester commented at 5:22 am on August 20, 2014: none
    Automatic 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.
  15. TheBlueMatt commented at 10:35 pm on August 20, 2014: member
    ut ACK.
  16. 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.

  17. 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!
  18. jgarzik merged this on Aug 21, 2014
  19. jgarzik closed this on Aug 21, 2014

  20. jgarzik referenced this in commit f368af3d5d on Aug 21, 2014
  21. jgarzik deleted the branch on Aug 24, 2014
  22. laanwj referenced this in commit d4e404a3af on Dec 20, 2017
  23. PastaPastaPasta referenced this in commit b53223581d on Jan 17, 2020
  24. PastaPastaPasta referenced this in commit 690189b9d2 on Jan 22, 2020
  25. PastaPastaPasta referenced this in commit 332b024009 on Jan 22, 2020
  26. PastaPastaPasta referenced this in commit d49f484027 on Jan 29, 2020
  27. PastaPastaPasta referenced this in commit e5a8e6f4ea on Jan 29, 2020
  28. PastaPastaPasta referenced this in commit f5ea528ecc on Jan 29, 2020
  29. PastaPastaPasta referenced this in commit 3654f15c91 on Jan 31, 2020
  30. ckti referenced this in commit 735b2f2543 on Mar 28, 2021
  31. MarcoFalke 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-12-19 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me