Browse Source

FuzzTests: Update

cl-refactor
Dimitry 10 years ago
parent
commit
9cc14873c0
  1. 9
      test/fuzzTesting/createRandomTest.cpp
  2. 2
      test/fuzzTesting/fuzzHelper.cpp

9
test/fuzzTesting/createRandomTest.cpp

@ -263,6 +263,9 @@ void parseTestWithTypes(std::string& _test)
if (types.at(i) == "[HEX]")
_test.replace(pos, 5, dev::test::RandomCode::randomUniIntHex());
else
if (types.at(i) == "[HEX32]")
_test.replace(pos, 7, dev::test::RandomCode::randomUniIntHex(std::numeric_limits<uint32_t>::max()));
else
if (types.at(i) == "[GASLIMIT]")
_test.replace(pos, 10, dev::test::RandomCode::randomUniIntHex(dev::u256("3000000000")));
else
@ -294,7 +297,7 @@ void parseTestWithTypes(std::string& _test)
std::vector<std::string> getTypes()
{
return {"[RLP]", "[CODE]", "[HEX]", "[HASH20]", "[HASH32]", "[0xHASH32]", "[V]", "[GASLIMIT]"};
return {"[RLP]", "[CODE]", "[HEX]", "[HEX32]", "[HASH20]", "[HASH32]", "[0xHASH32]", "[V]", "[GASLIMIT]"};
}
std::string const c_testExampleTransactionTest = R"(
@ -323,7 +326,7 @@ std::string const c_testExampleStateTest = R"(
"currentCoinbase" : "[HASH20]",
"currentDifficulty" : "[HEX]",
"currentGasLimit" : "[GASLIMIT]",
"currentNumber" : "[HEX]",
"currentNumber" : "[HEX32]",
"currentTimestamp" : "[HEX]",
"previousHash" : "[HASH32]"
},
@ -353,7 +356,7 @@ std::string const c_testExampleStateTest = R"(
"transaction" : {
"data" : "[CODE]",
"gasLimit" : "[HEX]",
"gasPrice" : "[V]",
"gasPrice" : "[HEX32]",
"nonce" : "0",
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",

2
test/fuzzTesting/fuzzHelper.cpp

@ -42,7 +42,7 @@ boostIntGenerator RandomCode::randOpLengGen = boostIntGenerator(gen, opLengDist)
boostIntGenerator RandomCode::randUniIntGen = boostIntGenerator(gen, uniIntDist);
boostUInt64Generator RandomCode::randUInt64Gen = boostUInt64Generator(gen, uInt64Dist);
int RandomCode::recursiveRLP(std::string &_result, int _depth, std::string& _debug)
int RandomCode::recursiveRLP(std::string& _result, int _depth, std::string& _debug)
{
bool genValidRlp = true;
int bugProbability = randUniIntGen() % 100;

Loading…
Cancel
Save