No description provided.
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-
luke-jr commented at 11:52 PM on September 19, 2015: member
-
bloom_tests: Do not depend on specific serialisations 2c4dda59b0
- laanwj added the label Tests on Sep 21, 2015
-
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.
-
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.
-
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.
-
dcousens commented at 3:26 AM on November 24, 2015: contributor
If this is wanted, then any reason not to merge?
-
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.
-
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...
-
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.
- laanwj closed this on Jan 20, 2016
- DrahtBot locked this on Sep 8, 2021