-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use fixture templates to allow running same tests on different implem…
…entations (#1080) Currently we are using the "old" bitcoin validation functions, wrapped in the `LegacyValidationInterface`, as introduced when finally removing Proof-of-Work in #929. In that pull request we hid the existing validation functions behind an interface so we could swap out the legacy function against the new ones from `staking::BlockValidator` - featuring the same interface. Ultimately we want to use the new `staking::BlockValidator` which is not in use currently. In order to verify that a second implementation of the `LegacyValidationInterface` which will delegate to `staking::BlockValidator` does the same validations as the existing functions it would be nice to have a way of running the same unit test suite against different instances of it. This pull request uses `BOOST_AUTO_TEST_CASE_TEMPLATE` to achieve exactly that. It is extracted from #939. [`BOOST_AUTO_TEST_CASE_TEMPLATE`](https://www.boost.org/doc/libs/1_46_0/libs/test/doc/html/utf/user-guide/test-organization/auto-test-case-template.html) will allow to check both implementations of `LegacyValidationInterface` (introduced in #929) to do the right thing. This way the same test tests the two, since they are providing the same interface. The new implementation of LegacyValidationInterface will land in a separate pull request. Thus the tests currently only operate on one fixture. One can add arbitrary number of Fixtures to the `TestFixtures` type which is a [boost mpl list](https://www.boost.org/doc/libs/1_63_0/libs/mpl/doc/index.html). Signed-off-by: Julian Fleischer <julian@thirdhash.com>
- Loading branch information
Showing
1 changed file
with
69 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters