diff options
author | Gav Wood <g@ethdev.com> | 2014-11-25 00:03:43 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2014-11-25 00:03:43 +0800 |
commit | d2ea1d7cc6e409043282c1eb421f3b8fffb76d04 (patch) | |
tree | 716174bb7fc7bc939a55cdd16a150dcfcc9fb08e /TestHelper.cpp | |
parent | 1376dd649c501ea55102085049e89d96dd025875 (diff) | |
parent | e450bde11357bf4d138b8008c5c201d9ee91ce3e (diff) | |
download | dexon-solidity-d2ea1d7cc6e409043282c1eb421f3b8fffb76d04.tar.gz dexon-solidity-d2ea1d7cc6e409043282c1eb421f3b8fffb76d04.tar.zst dexon-solidity-d2ea1d7cc6e409043282c1eb421f3b8fffb76d04.zip |
Merge pull request #533 from CJentzsch/stateTests
Specify user defined test
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r-- | TestHelper.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index c4128932..b3d1bbe8 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -322,12 +322,13 @@ void userDefinedTest(string testTypeFlag, std::function<void(json_spirit::mValue string arg = boost::unit_test::framework::master_test_suite().argv[i]; if (arg == testTypeFlag) { - if (i + 1 >= boost::unit_test::framework::master_test_suite().argc) + if (boost::unit_test::framework::master_test_suite().argc <= i + 2) { - cnote << "Missing filename\nUsage: testeth " << testTypeFlag << " <filename>\n"; + cnote << "Missing filename\nUsage: testeth " << testTypeFlag << " <filename> <testname>\n"; return; } string filename = boost::unit_test::framework::master_test_suite().argv[i + 1]; + string testname = boost::unit_test::framework::master_test_suite().argv[i + 2]; int currentVerbosity = g_logVerbosity; g_logVerbosity = 12; try @@ -337,7 +338,19 @@ void userDefinedTest(string testTypeFlag, std::function<void(json_spirit::mValue string s = asString(contents(filename)); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + filename + " is empty. "); json_spirit::read_string(s, v); - doTests(v, false); + json_spirit::mObject oSingleTest; + + json_spirit::mObject::const_iterator pos = v.get_obj().find(testname); + if (pos == v.get_obj().end()) + { + cnote << "Could not find test: " << testname << " in " << filename << "\n"; + return; + } + else + oSingleTest[pos->first] = pos->second; + + json_spirit::mValue v_singleTest(oSingleTest); + doTests(v_singleTest, false); } catch (Exception const& _e) { |