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

2
test/fuzzTesting/fuzzHelper.cpp

@ -42,7 +42,7 @@ boostIntGenerator RandomCode::randOpLengGen = boostIntGenerator(gen, opLengDist)
boostIntGenerator RandomCode::randUniIntGen = boostIntGenerator(gen, uniIntDist); boostIntGenerator RandomCode::randUniIntGen = boostIntGenerator(gen, uniIntDist);
boostUInt64Generator RandomCode::randUInt64Gen = boostUInt64Generator(gen, uInt64Dist); 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; bool genValidRlp = true;
int bugProbability = randUniIntGen() % 100; int bugProbability = randUniIntGen() % 100;

Loading…
Cancel
Save