Fabcoin Core  0.16.2
P2P Digital Currency
BlockChainTestsBoost.cpp
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16 */
23 #include <boost/filesystem/operations.hpp>
24 #include <boost/test/unit_test.hpp>
25 #include <boost/filesystem.hpp>
28 
29 class frontierFixture { public: frontierFixture() { dev::test::TestBlockChain::s_sealEngineNetwork = eth::Network::FrontierTest; } };
30 class homesteadFixture { public: homesteadFixture() { dev::test::TestBlockChain::s_sealEngineNetwork = eth::Network::HomesteadTest; } };
31 class transitionFixture { public: transitionFixture() { dev::test::TestBlockChain::s_sealEngineNetwork = eth::Network::TransitionnetTest; } };
32 class eip150Fixture { public: eip150Fixture() { dev::test::TestBlockChain::s_sealEngineNetwork = eth::Network::EIP150Test; } };
33 
34 
35 //BlockChainTestsTransition
36 BOOST_FIXTURE_TEST_SUITE(BlockChainTestsTransition, transitionFixture)
37 BOOST_AUTO_TEST_CASE(bcSimpleTransition) { dev::test::executeTests("bcSimpleTransitionTest", "/BlockchainTests/TestNetwork", "/BlockchainTestsFiller/TestNetwork", dev::test::doBlockchainTests); }
38 BOOST_AUTO_TEST_CASE(bcTheDaoTest) { dev::test::executeTests("bcTheDaoTest", "/BlockchainTests/TestNetwork", "/BlockchainTestsFiller/TestNetwork", dev::test::doBlockchainTests); }
39 BOOST_AUTO_TEST_CASE(bcEIP150Test) { dev::test::executeTests("bcEIP150Test", "/BlockchainTests/TestNetwork", "/BlockchainTestsFiller/TestNetwork", dev::test::doBlockchainTests); }
41 
42 
43 //BlockChainTestsEIP150
44 BOOST_FIXTURE_TEST_SUITE(BlockChainTestsEIP150, eip150Fixture)
45 BOOST_AUTO_TEST_CASE(bcForkStressTestEIP150) { dev::test::executeTests("bcForkStressTest", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
46 BOOST_AUTO_TEST_CASE(bcSuicideIssueEIP150)
47  {
48  if (dev::test::Options::get().memory)
49  dev::test::executeTests("bcSuicideIssue", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests);
50  }
51 BOOST_AUTO_TEST_CASE(bcTotalDifficultyTestEIP150) { dev::test::executeTests("bcTotalDifficultyTest", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
52 BOOST_AUTO_TEST_CASE(bcMultiChainTestEIP150) { dev::test::executeTests("bcMultiChainTest", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
53 BOOST_AUTO_TEST_CASE(bcRPC_API_TestEIP150) { dev::test::executeTests("bcRPC_API_Test", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
54 BOOST_AUTO_TEST_CASE(bcValidBlockTestEIP150) { dev::test::executeTests("bcValidBlockTest", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
55 BOOST_AUTO_TEST_CASE(bcInvalidHeaderTestEIP150) { dev::test::executeTests("bcInvalidHeaderTest", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
56 BOOST_AUTO_TEST_CASE(bcUncleHeaderValiditiyEIP150) { dev::test::executeTests("bcUncleHeaderValiditiy", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
57 BOOST_AUTO_TEST_CASE(bcGasPricerTestEIP150) { dev::test::executeTests("bcGasPricerTest", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
58 BOOST_AUTO_TEST_CASE(bcUncleTestEIP150) { dev::test::executeTests("bcUncleTest", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
59 BOOST_AUTO_TEST_CASE(bcBlockGasLimitTestEIP150) { dev::test::executeTests("bcBlockGasLimitTest", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
60 BOOST_AUTO_TEST_CASE(bcStateTestEIP150) { dev::test::executeTests("bcStateTest", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests); }
61 BOOST_AUTO_TEST_CASE(bcWalletTestEIP150)
62 {
63  if (test::Options::get().wallet)
64  dev::test::executeTests("bcWalletTest", "/BlockchainTests/EIP150", "/BlockchainTestsFiller/EIP150", dev::test::doBlockchainTests);
65 }
67 
68 
69 //BlockChainTestsHomestead
70 BOOST_FIXTURE_TEST_SUITE(BlockChainTestsHomestead, homesteadFixture)
71 BOOST_AUTO_TEST_CASE(bcExploitTestHomestead) { dev::test::executeTests("bcExploitTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
72 BOOST_AUTO_TEST_CASE(bcSuicideIssueHomestead)
73 {
74  if (dev::test::Options::get().memory)
75  dev::test::executeTests("bcSuicideIssue", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests);
76 }
77 BOOST_AUTO_TEST_CASE(bcShanghaiLoveHomestead) { dev::test::executeTests("bcShanghaiLove", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
78 BOOST_AUTO_TEST_CASE(bcForkStressTestHomestead) { dev::test::executeTests("bcForkStressTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
79 BOOST_AUTO_TEST_CASE(bcTotalDifficultyTestHomestead) { dev::test::executeTests("bcTotalDifficultyTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
80 BOOST_AUTO_TEST_CASE(bcMultiChainTestHomestead) { dev::test::executeTests("bcMultiChainTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
81 BOOST_AUTO_TEST_CASE(bcInvalidRLPTestHomestead)
82 {
83  std::string fillersPath = dev::test::getTestPath() + "/src/BlockchainTestsFiller/Homestead";
84  if (!dev::test::Options::get().filltests)
85  dev::test::executeTests("bcInvalidRLPTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests);
86  else
87  {
89  dev::test::copyFile(fillersPath + "/bcInvalidRLPTest.json", dev::test::getTestPath() + "/BlockchainTests/Homestead/bcInvalidRLPTest.json");
90  }
91 }
92 BOOST_AUTO_TEST_CASE(bcRPC_API_TestHomestead) { dev::test::executeTests("bcRPC_API_Test", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests);}
93 BOOST_AUTO_TEST_CASE(bcValidBlockTestHomestead) { dev::test::executeTests("bcValidBlockTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
94 BOOST_AUTO_TEST_CASE(bcInvalidHeaderTestHomestead) { dev::test::executeTests("bcInvalidHeaderTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
95 BOOST_AUTO_TEST_CASE(bcUncleHeaderValiditiyHomestead) { dev::test::executeTests("bcUncleHeaderValiditiy", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests);}
96 BOOST_AUTO_TEST_CASE(bcGasPricerTestHomestead) { dev::test::executeTests("bcGasPricerTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
97 BOOST_AUTO_TEST_CASE(bcUncleTestHomestead) { dev::test::executeTests("bcUncleTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
98 BOOST_AUTO_TEST_CASE(bcBlockGasLimitTestHomestead) { dev::test::executeTests("bcBlockGasLimitTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
99 BOOST_AUTO_TEST_CASE(bcStateTestHomestead) { dev::test::executeTests("bcStateTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests); }
100 BOOST_AUTO_TEST_CASE(bcWalletTestHomestead)
101 {
102  if (test::Options::get().wallet)
103  dev::test::executeTests("bcWalletTest", "/BlockchainTests/Homestead", "/BlockchainTestsFiller/Homestead", dev::test::doBlockchainTests);
104 }
106 
107 
108 //BlockChainTests
110 BOOST_AUTO_TEST_CASE(bcForkBlockTest)
111 {
112  std::string fillersPath = dev::test::getTestPath() + "/src/BlockchainTestsFiller";
113  if (!dev::test::Options::get().filltests)
114  dev::test::executeTests("bcForkBlockTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests);
115  else
116  {
118  dev::test::copyFile(fillersPath + "/bcForkBlockTest.json", dev::test::getTestPath() + "/BlockchainTests/bcForkBlockTest.json");
119  }
120 }
121 BOOST_AUTO_TEST_CASE(bcForkUncleTest)
122 {
123  std::string fillersPath = dev::test::getTestPath() + "/src/BlockchainTestsFiller";
124  if (!dev::test::Options::get().filltests)
125  dev::test::executeTests("bcForkUncle", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests);
126  else
127  {
129  dev::test::copyFile(fillersPath + "/bcForkUncle.json", dev::test::getTestPath() + "/BlockchainTests/bcForkUncle.json");
130  }
131 }
132 BOOST_AUTO_TEST_CASE(bcForkStressTest) { dev::test::executeTests("bcForkStressTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
133 BOOST_AUTO_TEST_CASE(bcMultiChainTest) { dev::test::executeTests("bcMultiChainTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
134 BOOST_AUTO_TEST_CASE(bcTotalDifficultyTest) { dev::test::executeTests("bcTotalDifficultyTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
135 BOOST_AUTO_TEST_CASE(bcInvalidRLPTest)
136 {
137  std::string fillersPath = dev::test::getTestPath() + "/src/BlockchainTestsFiller";
138  if (!dev::test::Options::get().filltests)
139  dev::test::executeTests("bcInvalidRLPTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests);
140  else
141  {
143  dev::test::copyFile(fillersPath + "/bcInvalidRLPTest.json", dev::test::getTestPath() + "/BlockchainTests/bcInvalidRLPTest.json");
144  }
145 }
146 BOOST_AUTO_TEST_CASE(bcRPC_API_Test) { dev::test::executeTests("bcRPC_API_Test", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
147 BOOST_AUTO_TEST_CASE(bcValidBlockTest) { dev::test::executeTests("bcValidBlockTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
148 BOOST_AUTO_TEST_CASE(bcInvalidHeaderTest) { dev::test::executeTests("bcInvalidHeaderTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
149 BOOST_AUTO_TEST_CASE(bcUncleTest) { dev::test::executeTests("bcUncleTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
150 BOOST_AUTO_TEST_CASE(bcUncleHeaderValiditiy) { dev::test::executeTests("bcUncleHeaderValiditiy", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
151 BOOST_AUTO_TEST_CASE(bcGasPricerTest) { dev::test::executeTests("bcGasPricerTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
152 BOOST_AUTO_TEST_CASE(bcBlockGasLimitTest) { dev::test::executeTests("bcBlockGasLimitTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
153 BOOST_AUTO_TEST_CASE(bcWalletTest)
154 {
155  if (test::Options::get().wallet)
156  dev::test::executeTests("bcWalletTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests);
157 }
158 BOOST_AUTO_TEST_CASE(bcStateTest) { dev::test::executeTests("bcStateTest", "/BlockchainTests", "/BlockchainTestsFiller", dev::test::doBlockchainTests); }
159 BOOST_AUTO_TEST_CASE(userDefinedFile)
160 {
162 }
BOOST_AUTO_TEST_CASE(bcSimpleTransition)
static Options const & get(int argc=0, char **argv=0)
Get reference to options The first time used, options are parsed with argc, argv. ...
Definition: Options.cpp:203
static eth::Network s_sealEngineNetwork
void userDefinedTest(std::function< void(json_spirit::mValue &, bool)> doTests)
Definition: TestHelper.cpp:386
std::string getTestPath()
Definition: Common.cpp:35
void copyFile(std::string const &_source, std::string const &_destination)
Definition: TestHelper.cpp:492
#define BOOST_FIXTURE_TEST_SUITE(a, b)
Definition: object.cpp:14
#define BOOST_AUTO_TEST_SUITE_END()
Definition: object.cpp:16
void doBlockchainTests(json_spirit::mValue &_v, bool _fillin)
void executeTests(const string &_name, const string &_testPathAppendix, const string &_fillerPathAppendix, std::function< void(json_spirit::mValue &, bool)> doTests, bool _addFillerSuffix)
Definition: TestHelper.cpp:434
Helper functions to work with json::spirit and test files.
static void initTest(int _maxTests=1)