Browse Source

RLPFuzz: update

cl-refactor
Dimitry 10 years ago
parent
commit
6ff3e01184
  1. 2
      test/fuzzTesting/fuzzHelper.h
  2. 24
      test/libdevcore/rlp.cpp

2
test/fuzzTesting/fuzzHelper.h

@ -99,7 +99,7 @@ private:
static std::string fillArguments(dev::eth::Instruction _opcode, RandomCodeOptions const& _options);
static std::string getPushCode(int _value);
static std::string getPushCode(std::string const& _hex);
static int recursiveRLP(std::string &_result, int _depth, std::string& _debug);
static int recursiveRLP(std::string& _result, int _depth, std::string& _debug);
static void refreshSeed();
static boost::random::mt19937 gen; ///< Random generator

24
test/libdevcore/rlp.cpp

@ -72,8 +72,6 @@ namespace dev
bytes payloadToDecode = fromHex(o["out"].get_str());
RLP payload(payloadToDecode);
ostringstream() << payload;
if (payload.isEmpty())
BOOST_THROW_EXCEPTION(RLPException() << errinfo_comment("Decoded Empty RLP!"));
o["in"] = "VALID";
}
catch (Exception const& _e)
@ -244,6 +242,28 @@ namespace dev
BOOST_AUTO_TEST_SUITE(RlpTests)
BOOST_AUTO_TEST_CASE(EmptyArrayList)
{
try
{
bytes payloadToDecode = fromHex("80");
RLP payload(payloadToDecode);
ostringstream() << payload;
payloadToDecode = fromHex("с0");
RLP payload2(payloadToDecode);
ostringstream() << payload2;
}
catch (Exception const& _e)
{
TBOOST_ERROR("Failed test with Exception: " << _e.what());
}
catch (exception const& _e)
{
TBOOST_ERROR("Failed test with Exception: " << _e.what());
}
}
BOOST_AUTO_TEST_CASE(invalidRLPtest)
{
dev::test::executeTests("invalidRLPTest", "/RLPTests", dev::test::getFolder(__FILE__) + "/RLPTestsFiller", dev::test::doRlpTests);

Loading…
Cancel
Save