diff options
author | Christoph Jentzsch <jentzsch.software@gmail.com> | 2014-11-21 03:41:35 +0800 |
---|---|---|
committer | Christoph Jentzsch <jentzsch.software@gmail.com> | 2014-11-21 03:41:35 +0800 |
commit | 16be7563e1a5e0b2b16859b46058a88adc76c203 (patch) | |
tree | 9c8c133c4ddae8778256507dd7ab9cecac55ac08 | |
parent | a879115143aa61ff13cc914ef8be76e8ee67a6f4 (diff) | |
download | dexon-solidity-16be7563e1a5e0b2b16859b46058a88adc76c203.tar.gz dexon-solidity-16be7563e1a5e0b2b16859b46058a88adc76c203.tar.zst dexon-solidity-16be7563e1a5e0b2b16859b46058a88adc76c203.zip |
Specify user defined test
-rw-r--r-- | TestHelper.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index 114399a4..4ce17589 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -310,12 +310,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 (i + 2 >= boost::unit_test::framework::master_test_suite().argc) { - 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 @@ -325,7 +326,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) { |