bloom_tests: Do not depend on specific serialisations #6700

pull luke-jr wants to merge 1 commits into bitcoin:master from luke-jr:bloom_tests_not_ser changing 1 files +715 −47
  1. luke-jr commented at 11:52 PM on September 19, 2015: member

    No description provided.

  2. bloom_tests: Do not depend on specific serialisations 2c4dda59b0
  3. laanwj added the label Tests on Sep 21, 2015
  4. laanwj commented at 11:57 AM on September 21, 2015: member

    ACK, I think it's a good idea to build the transactions in-place instead of hardcoding them.

  5. dcousens commented at 1:43 AM on September 22, 2015: contributor

    @laanwj could we use a JSON format instead?

    Relying on the test creator to intricately build a transaction each time can be more error prone then just adapting a human-readable data format to what is needed for the test case.

  6. luke-jr commented at 2:00 AM on September 22, 2015: member

    @dcousens Error-prone in what sense? Remember the purpose here is to find errors. :)

  7. dcousens commented at 3:29 AM on September 22, 2015: contributor

    @luke-jr from my own experience in writing tests for https://github.com/bitcoinjs/bitcoinjs-lib, the most common source of regressions / uncaught errors was actually in the test being poorly written, or a simple syntax error causing something to be missed. This may have been symptomatic of how wonderful Javascript is as a language.

    Adopting a data-driven approach for us meant we only had to validate one test function that built the test data, and then validated it, from a human readable data format. In our case, some of that data can be seen here.

    The serialized transaction in its hex form is included for a byte-for-byte comparison, but it should be evident that the test data is verbose enough that you can easily read and add test fixtures.

  8. laanwj commented at 9:45 AM on September 22, 2015: member

    In general I'm in favor of data-driven tests, as it alllows comparing between implementations.

    But there is a good point that tests should not be too fragile, they should only break when something is wrong, so they should test what matters, not the e.g. an exact sequence of steps if only the outcome is relevant.

    In the case of bloom filtering the goal is to test bloom filtering. Not transaction serialization/deserialization. If the transaction format changes (e.g. as in elements, or an altcoin), this test should ideally not break.

    I'm not entirely convinced that data-driven tests will add something here.

  9. dcousens commented at 8:11 AM on October 22, 2015: contributor

    @laanwj the alternative of in-lining all the TX construction code seems worse IMHO. Why not break it out to a JSON file to keep the tests streamline? (I may be underestimating how 'streamline' this will be for C++ however)

  10. dcousens commented at 3:26 AM on November 24, 2015: contributor

    If this is wanted, then any reason not to merge?

  11. laanwj commented at 9:37 AM on November 24, 2015: member

    I don't feel strongly enough about it to merge it. Certainly with just my ACK. Seems at least you have some concerns with it.

    Needs input from different people.

  12. dcousens commented at 3:06 AM on November 25, 2015: contributor

    @laanwj my concern is this makes it more difficult to port these tests to other libraries based on the serialized transactions alone. But it does make the tests more transparent as to what they might actually be testing.

  13. luke-jr commented at 6:51 PM on January 17, 2016: member

    @dcousens I don't think it makes these any more difficult than any other tests we already have?

  14. dcousens commented at 1:11 AM on January 18, 2016: contributor

    @luke-jr well, the serialized JSON fixtures are usually as simple as a copy paste. These fixtures would mean I'd have to compile the code and generate the fixtures my self.

  15. luke-jr commented at 1:58 AM on January 18, 2016: member

    I'm comparing it with the other tests, not the current version of this test...

  16. laanwj commented at 12:16 PM on January 20, 2016: member

    It doesn't seem there is strong enough consensus to make this change, so going to close this.

  17. laanwj closed this on Jan 20, 2016

  18. DrahtBot locked this on Sep 8, 2021
Labels

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: 2026-04-14 15:15 UTC

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