-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to run unit tests in both Legacy and Savanna (Part 1) #145
Conversation
//todoBOOST_REQUIRE_EQUAL(true, chain_has_transaction(trace->id)); | ||
|
||
} FC_LOG_AND_RETHROW() } | ||
|
||
|
||
BOOST_AUTO_TEST_CASE(update_auths) { | ||
try { | ||
validating_tester chain; | ||
savanna_validating_tester chain; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chain.find
on line 120 below causes compilation failure when BOOST_AUTO_TEST_CASE_TEMPLATE
is used. We test Savanna for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably just need chain.template find<permission_object, by_owner>(boost::make_tuple(name("alice"), name("owner")));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank! It worked.
create_accounts( {"alice"_n} ); | ||
produce_block(); | ||
BOOST_AUTO_TEST_CASE_TEMPLATE( missing_sigs, TESTER, validating_testers ) { try { | ||
TESTER chain; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if there was a way to combine BOOST_AUTO_TEST_CASE_TEMPLATE
and BOOST_FIXTURE_TEST_CASE
so that TESTER chain;
was not needed. I don't see a way to do that, but maybe @spoonincode might know a way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can use the (sparsely documented?1) BOOST_FIXTURE_TEST_CASE_TEMPLATE
for example
BOOST_AUTO_TEST_CASE_TEMPLATE( missing_sigs, T, validating_testers, T ) { try {
but there is a problem with dependent lookup so you're going to get stuck with doing either
BOOST_AUTO_TEST_CASE_TEMPLATE( missing_sigs, T, validating_testers, T ) { try {
this->create_accounts( {"alice"_n} );
T::produce_block();
so it's not immediately clear to me if it's any better or not.
Footnotes
-
I only found it documented at the very bottom of this page https://www.boost.org/doc/libs/1_85_0/libs/test/doc/html/boost_test/tests_organization/decorators/explicit_decorator_declaration.html ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this. Either way is fine. But I think chain.create_accounts
is more readable. We can just keep it as is.
Note:start |
This PR (and subsequent ones) addresses those requirements:
This is the first PR which demonstrates how running both modes can be achieved. After it is approved, it will be applied to other tests.
Both
BOOST_AUTO_TEST_CASE_TEMPLATE
andBOOST_FIXTURE_TEST_CASE_TEMPLATE
work. Either involves about the same amount of coding. If an original test already usetester chain;
declaration,BOOST_AUTO_TEST_CASE_TEMPLATE
requires fewer changes; if it uses a fixture,BOOST_FIXTURE_TEST_CASE_TEMPLATE
can be used, but it requires addingthis
orT
in front of methods.Partially resolves #11