diff options
author | Gav Wood <g@ethdev.com> | 2014-11-14 19:08:49 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2014-11-14 19:08:49 +0800 |
commit | c82174c1dd2ffc99070a1b38c17df35a039793b6 (patch) | |
tree | 72c6cdae10b58b213417ce6263e792f8b83e3521 /TestHelper.cpp | |
parent | a0a8c61a7e1b27907671a3a95fef1217a82f5fb7 (diff) | |
parent | 4f589053a028ee95fecdb0e6db523444bb875224 (diff) | |
download | dexon-solidity-c82174c1dd2ffc99070a1b38c17df35a039793b6.tar.gz dexon-solidity-c82174c1dd2ffc99070a1b38c17df35a039793b6.tar.zst dexon-solidity-c82174c1dd2ffc99070a1b38c17df35a039793b6.zip |
Merge pull request #510 from CJentzsch/NewStateTests
create new tests with command line options
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r-- | TestHelper.cpp | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index c1a141ab..1b13f9e8 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -27,8 +27,6 @@ #include <libethereum/Client.h> #include <liblll/Compiler.h> -//#define FILL_TESTS - using namespace std; using namespace dev::eth; @@ -351,28 +349,33 @@ void executeTests(const string& _name, const string& _testPathAppendix, std::fun string testPath = getTestPath(); testPath += _testPathAppendix; -#ifdef FILL_TESTS - try - { - cnote << "Populating tests..."; - json_spirit::mValue v; - boost::filesystem::path p(__FILE__); - boost::filesystem::path dir = p.parent_path(); - string s = asString(dev::contents(dir.string() + "/" + _name + "Filler.json")); - BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + dir.string() + "/" + _name + "Filler.json is empty."); - json_spirit::read_string(s, v); - doTests(v, true); - writeFile(testPath + "/" + _name + ".json", asBytes(json_spirit::write_string(v, true))); - } - catch (Exception const& _e) - { - BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e)); - } - catch (std::exception const& _e) + for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) { - BOOST_ERROR("Failed test with Exception: " << _e.what()); + string arg = boost::unit_test::framework::master_test_suite().argv[i]; + if (arg == "--filltests") + { + try + { + cnote << "Populating tests..."; + json_spirit::mValue v; + boost::filesystem::path p(__FILE__); + boost::filesystem::path dir = p.parent_path(); + string s = asString(dev::contents(dir.string() + "/" + _name + "Filler.json")); + BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + dir.string() + "/" + _name + "Filler.json is empty."); + json_spirit::read_string(s, v); + doTests(v, true); + writeFile(testPath + "/" + _name + ".json", asBytes(json_spirit::write_string(v, true))); + } + catch (Exception const& _e) + { + BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e)); + } + catch (std::exception const& _e) + { + BOOST_ERROR("Failed test with Exception: " << _e.what()); + } + } } -#endif try { |