diff options
author | Paweł Bylica <chfast@gmail.com> | 2014-11-27 03:20:52 +0800 |
---|---|---|
committer | Paweł Bylica <chfast@gmail.com> | 2014-11-27 03:20:52 +0800 |
commit | a5d0496ea497f272929a959af19c8e810895080c (patch) | |
tree | af41c8f3ea558d9d4828c3014b09793f8c4b3259 /TestHelper.cpp | |
parent | 508d9f3b6886ee884cca51aff7625216b36b93a1 (diff) | |
parent | 0cd1e7655348727560218b6a00725d7231535cdf (diff) | |
download | dexon-solidity-a5d0496ea497f272929a959af19c8e810895080c.tar.gz dexon-solidity-a5d0496ea497f272929a959af19c8e810895080c.tar.zst dexon-solidity-a5d0496ea497f272929a959af19c8e810895080c.zip |
Merge branch 'develop' into develop-evmcc
Conflicts:
libevm/VM.h
test/vm.cpp
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r-- | TestHelper.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index 31696da0..ca0394b8 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -293,6 +293,18 @@ void checkStorage(map<u256, u256> _expectedStore, map<u256, u256> _resultStore, } } +void checkLog(LogEntries _resultLogs, LogEntries _expectedLogs) +{ + BOOST_REQUIRE_EQUAL(_resultLogs.size(), _expectedLogs.size()); + + for (size_t i = 0; i < _resultLogs.size(); ++i) + { + BOOST_CHECK_EQUAL(_resultLogs[i].address, _expectedLogs[i].address); + BOOST_CHECK_EQUAL(_resultLogs[i].topics, _expectedLogs[i].topics); + BOOST_CHECK(_resultLogs[i].data == _expectedLogs[i].data); + } +} + std::string getTestPath() { string testPath; @@ -316,12 +328,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 @@ -331,7 +344,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) { |