Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
adress Andrey's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
winsvega committed Nov 3, 2019
1 parent 3d1a26b commit acd1cab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
4 changes: 2 additions & 2 deletions test/tools/jsontests/BlockChainTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ class bcTransitionFixture {
BOOST_AUTO_TEST_SUITE(BlockchainTests)

// Tests that contain only valid blocks and check that import is correct
BOOST_FIXTURE_TEST_SUITE(ValidBlocks, bcValidTestFixture<test::BlockchainValidTestSuite>)
BOOST_FIXTURE_TEST_SUITE(ValidBlocks, bcTestFixture<test::BlockchainValidTestSuite>)
BOOST_AUTO_TEST_CASE(bcBlockGasLimitTest) {}
BOOST_AUTO_TEST_CASE(bcExploitTest) {}
BOOST_AUTO_TEST_CASE(bcForkStressTest) {}
Expand All @@ -1078,7 +1078,7 @@ BOOST_AUTO_TEST_CASE(bcWalletTest) {}
BOOST_AUTO_TEST_SUITE_END()

// Tests that might have invalid blocks and check that those are rejected
BOOST_FIXTURE_TEST_SUITE(InvalidBlocks, bcInvalidTestFixture<test::BlockchainInvalidTestSuite>)
BOOST_FIXTURE_TEST_SUITE(InvalidBlocks, bcTestFixture<test::BlockchainInvalidTestSuite>)
BOOST_AUTO_TEST_CASE(bcBlockGasLimitTest) {}
BOOST_AUTO_TEST_CASE(bcForgedTest) {}
BOOST_AUTO_TEST_CASE(bcInvalidHeaderTest) {}
Expand Down
23 changes: 2 additions & 21 deletions test/tools/jsontests/BlockChainTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class bcGeneralTestsFixture : public StateTestFixtureBase<BCGeneralStateTestsSui
};

template <class T>
class bcValidTestFixture
class bcTestFixture
{
public:
bcValidTestFixture(std::set<TestExecution> const& _execFlags = {})
bcTestFixture(std::set<TestExecution> const& _execFlags = {})
{
T suite;
if (_execFlags.count(TestExecution::NotRefillable) &&
Expand All @@ -71,25 +71,6 @@ class bcValidTestFixture
}
};

template <class T>
class bcInvalidTestFixture
{
public:
bcInvalidTestFixture(std::set<TestExecution> const& _execFlags = {})
{
T suite;
if (_execFlags.count(TestExecution::NotRefillable) &&
(Options::get().fillchain || Options::get().filltests))
BOOST_FAIL("Tests are sealed and not refillable!");

string const casename = boost::unit_test::framework::current_test_case().p_name;
boost::filesystem::path suiteFillerPath = suite.getFullPathFiller(casename).parent_path();

suite.runAllTestsInFolder(casename);
test::TestOutputHelper::get().markTestFolderAsFinished(suiteFillerPath, casename);
}
};

class TransitionTestsSuite: public TestSuite
{
json_spirit::mValue doTests(json_spirit::mValue const& _input, bool _fillin) const override;
Expand Down
12 changes: 6 additions & 6 deletions test/tools/jsontests/LegacyTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BCGeneralStateTestsSuiteLegacyConstantinople : public BCGeneralStateTestsS
}
};

class BlockchainInvalidTestSuiteLegacyConstantinople : public BlockchainInvalidTestSuite
class LegacyConstantinopleBlockchainInvalidTestSuite : public BlockchainInvalidTestSuite
{
boost::filesystem::path suiteFolder() const override
{
Expand All @@ -49,7 +49,7 @@ class BlockchainInvalidTestSuiteLegacyConstantinople : public BlockchainInvalidT
}
};

class BlockchainValidTestSuiteLegacyConstantinople : public BlockchainValidTestSuite
class LegacyConstantinopleBlockchainValidTestSuite : public BlockchainValidTestSuite
{
boost::filesystem::path suiteFolder() const override
{
Expand Down Expand Up @@ -81,19 +81,19 @@ class LegacyConstantinopleBCGeneralStateTestFixture
};

class LegacyConstantinoplebcInvalidTestFixture
: public bcInvalidTestFixture<BlockchainInvalidTestSuiteLegacyConstantinople>
: public bcTestFixture<LegacyConstantinopleBlockchainInvalidTestSuite>
{
public:
LegacyConstantinoplebcInvalidTestFixture()
: bcInvalidTestFixture({TestExecution::NotRefillable})
: bcTestFixture({TestExecution::NotRefillable})
{}
};

class LegacyConstantinoplebcValidTestFixture
: public bcValidTestFixture<BlockchainValidTestSuiteLegacyConstantinople>
: public bcTestFixture<LegacyConstantinopleBlockchainValidTestSuite>
{
public:
LegacyConstantinoplebcValidTestFixture() : bcValidTestFixture({TestExecution::NotRefillable}) {}
LegacyConstantinoplebcValidTestFixture() : bcTestFixture({TestExecution::NotRefillable}) {}
};


Expand Down

0 comments on commit acd1cab

Please sign in to comment.