diff --git a/test/TestHelper.h b/test/TestHelper.h index eaeed619a..649d4adf1 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -33,10 +33,10 @@ #define DONTUSE_BOOST_MACROS #ifdef DONTUSE_BOOST_MACROS - #define TBOOST_THROW_EXCEPTION(arg) throw; - #define TBOOST_REQUIRE(arg) if(arg == false) throw; - #define TBOOST_CHECK_MESSAGE(arg1, arg2) if(arg1 == false) throw; - #define TBOOST_WARN_MESSAGE(arg1, arg2) throw; + #define TBOOST_THROW_EXCEPTION(arg) throw dev::Exception(); + #define TBOOST_REQUIRE(arg) if(arg == false) throw dev::Exception(); + #define TBOOST_CHECK_MESSAGE(arg1, arg2) if(arg1 == false) throw dev::Exception(); + #define TBOOST_WARN_MESSAGE(arg1, arg2) throw dev::Exception(); #else #define TBOOST_THROW_EXCEPTION(arg) BOOST_THROW_EXCEPTION(arg) #define TBOOST_REQUIRE(arg) BOOST_REQUIRE(arg) diff --git a/test/fuzzTesting/createRandomTest.cpp b/test/fuzzTesting/createRandomTest.cpp index 92fd21b76..2177902d6 100644 --- a/test/fuzzTesting/createRandomTest.cpp +++ b/test/fuzzTesting/createRandomTest.cpp @@ -63,11 +63,28 @@ int main(int argc, char *argv[]) void randomTransactionTest() { - std::string newTest = c_testExampleTransactionTest; - parseTestWithTypes(newTest); + //redirect all output to the stream + std::ostringstream strCout; + std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); + std::cout.rdbuf( strCout.rdbuf() ); + std::cerr.rdbuf( strCout.rdbuf() ); + json_spirit::mValue v; - json_spirit::read_string(newTest, v); - dev::test::doTransactionTests(v, true); + try + { + std::string newTest = c_testExampleTransactionTest; + parseTestWithTypes(newTest); + json_spirit::read_string(newTest, v); + dev::test::doTransactionTests(v, true); + } + catch(...) + { + std::cerr << "Test fill exception!"; + } + + //restroe output + std::cout.rdbuf(oldCoutStreamBuf); + std::cerr.rdbuf(oldCoutStreamBuf); std::cout << json_spirit::write_string(v, true); }