diff options
author | Gav Wood <g@ethdev.com> | 2015-03-14 03:12:35 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2015-03-14 03:12:35 +0800 |
commit | 827b1e2b3db4def5a296ad32b264e0a8612df064 (patch) | |
tree | 87903cc960f2369bac3240f697f4890d7519728c /state.cpp | |
parent | a6f328a613718601c3507923996813a9e50988d5 (diff) | |
parent | 6243d0048bb9424388bca6970a11a865b18239c3 (diff) | |
download | dexon-solidity-827b1e2b3db4def5a296ad32b264e0a8612df064.tar dexon-solidity-827b1e2b3db4def5a296ad32b264e0a8612df064.tar.gz dexon-solidity-827b1e2b3db4def5a296ad32b264e0a8612df064.tar.bz2 dexon-solidity-827b1e2b3db4def5a296ad32b264e0a8612df064.tar.lz dexon-solidity-827b1e2b3db4def5a296ad32b264e0a8612df064.tar.xz dexon-solidity-827b1e2b3db4def5a296ad32b264e0a8612df064.tar.zst dexon-solidity-827b1e2b3db4def5a296ad32b264e0a8612df064.zip |
Merge pull request #1295 from CJentzsch/randomStateTests
Random state tests
Diffstat (limited to 'state.cpp')
-rw-r--r-- | state.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -248,6 +248,39 @@ BOOST_AUTO_TEST_CASE(stCreateTest) } } +BOOST_AUTO_TEST_CASE(stRandom) +{ + string testPath = dev::test::getTestPath(); + testPath += "/StateTests/RandomTests"; + + vector<boost::filesystem::path> testFiles; + boost::filesystem::directory_iterator iterator(testPath); + for(; iterator != boost::filesystem::directory_iterator(); ++iterator) + if (boost::filesystem::is_regular_file(iterator->path()) && iterator->path().extension() == ".json") + testFiles.push_back(iterator->path()); + + for (auto& path: testFiles) + { + try + { + cnote << "Testing ..." << path.filename(); + json_spirit::mValue v; + string s = asString(dev::contents(path.string())); + BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + path.string() + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?"); + json_spirit::read_string(s, v); + dev::test::doStateTests(v, false); + } + 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()); + } + } +} + BOOST_AUTO_TEST_CASE(userDefinedFileState) { dev::test::userDefinedTest("--singletest", dev::test::doStateTests); |