aboutsummaryrefslogtreecommitdiffstats
path: root/state.cpp
diff options
context:
space:
mode:
authorGav Wood <g@ethdev.com>2015-03-14 03:12:35 +0800
committerGav Wood <g@ethdev.com>2015-03-14 03:12:35 +0800
commit827b1e2b3db4def5a296ad32b264e0a8612df064 (patch)
tree87903cc960f2369bac3240f697f4890d7519728c /state.cpp
parenta6f328a613718601c3507923996813a9e50988d5 (diff)
parent6243d0048bb9424388bca6970a11a865b18239c3 (diff)
downloaddexon-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.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/state.cpp b/state.cpp
index 2f9ad628..d6790029 100644
--- a/state.cpp
+++ b/state.cpp
@@ -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);