From e3934b240108d58108030826d9c21af36498b6df Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 28 May 2014 16:28:41 +0200 Subject: [PATCH] Tests updated. Fixes to executive logging. Trie testing made considerably more rigourous. --- main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 35e56d191..42e673446 100644 --- a/main.cpp +++ b/main.cpp @@ -42,15 +42,18 @@ using namespace eth; BOOST_AUTO_TEST_CASE(basic_tests) { + cdebug << "Stress-testing Trie..."; { BasicMap m; + EnforceRefs e(m, true); GenericTrieDB d(&m); d.init(); // initialise as empty tree. MemTrie t; - for (int a = 0; a < 20; ++a) + assert(d.check().empty()); + for (int a = 0; a < 100; ++a) { StringMap m; - for (int i = 0; i < 20; ++i) + for (int i = 0; i < 100; ++i) { auto k = randomWord(); auto v = toString(i); @@ -59,6 +62,7 @@ BOOST_AUTO_TEST_CASE(basic_tests) d.insert(k, v); assert(hash256(m) == t.hash256()); assert(hash256(m) == d.root()); + assert(d.check().empty()); } while (!m.empty()) { @@ -68,6 +72,7 @@ BOOST_AUTO_TEST_CASE(basic_tests) m.erase(k); assert(hash256(m) == t.hash256()); assert(hash256(m) == d.root()); + assert(d.check().empty()); } } }