Fabcoin Core  0.16.2
P2P Digital Currency
Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
dev::test::RandomCode Class Reference

#include <fuzzHelper.h>

Static Public Member Functions

static std::string generate (int _maxOpNumber=1, RandomCodeOptions _options=RandomCodeOptions())
 Generate random vm code. More...
 
static void parseTestWithTypes (std::string &_test, std::map< std::string, std::string > const &_varMap)
 Replace keywords in given string with values. More...
 
static std::string rndByteSequence (int _length=1, SizeStrictness _sizeType=SizeStrictness::Strict)
 Generate random byte string of a given length. More...
 
static std::string rndRLPSequence (int _depth, std::string &_debug)
 Generate random rlp byte sequence of a given depth (e.g [[[]],[]]). More...
 
static std::string randomUniIntHex (u256 _maxVal=0)
 Generate random int64. More...
 
static u256 randomUniInt (u256 _maxVal=0)
 

Static Private Member Functions

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 void refreshSeed ()
 
static std::vector< std::string > getTypes ()
 

Static Private Attributes

static boost::random::mt19937 gen
 Random generator. More...
 
static boostIntDistrib opCodeDist = boostIntDistrib (0, 255)
 0..255 opcodes More...
 
static boostIntDistrib opLengDist = boostIntDistrib (1, 32)
 1..32 byte string More...
 
static boostIntDistrib uniIntDist = boostIntDistrib (0, 0x7fffffff)
 0..0x7fffffff More...
 
static boostUint64Distrib uInt64Dist = boostUint64Distrib (0, std::numeric_limits<uint64_t>::max())
 0..2**64 More...
 
static boostIntGenerator randUniIntGen = boostIntGenerator(gen, uniIntDist)
 Generate random UniformInt from uniIntDist. More...
 
static boostIntGenerator randOpCodeGen = boostIntGenerator(gen, opCodeDist)
 Generate random value from opCodeDist. More...
 
static boostIntGenerator randOpLengGen = boostIntGenerator(gen, opLengDist)
 Generate random length from opLengDist. More...
 
static boostUInt64Generator randUInt64Gen = boostUInt64Generator(gen, uInt64Dist)
 Generate random uInt64. More...
 

Detailed Description

Definition at line 75 of file fuzzHelper.h.

Member Function Documentation

std::string dev::test::RandomCode::fillArguments ( dev::eth::Instruction  _opcode,
RandomCodeOptions const &  _options 
)
staticprivate

Definition at line 287 of file fuzzHelper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string dev::test::RandomCode::generate ( int  _maxOpNumber = 1,
RandomCodeOptions  _options = RandomCodeOptions() 
)
static

Generate random vm code.

Definition at line 205 of file fuzzHelper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string dev::test::RandomCode::getPushCode ( int  _value)
staticprivate

Definition at line 281 of file fuzzHelper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string dev::test::RandomCode::getPushCode ( std::string const &  _hex)
staticprivate

Definition at line 274 of file fuzzHelper.cpp.

Here is the call graph for this function:

std::vector< std::string > dev::test::RandomCode::getTypes ( )
staticprivate

Definition at line 286 of file createRandomTest.cpp.

void dev::test::RandomCode::parseTestWithTypes ( std::string &  _test,
std::map< std::string, std::string > const &  _varMap 
)
static

Replace keywords in given string with values.

Parse Test string replacing keywords to fuzzed values.

Definition at line 209 of file createRandomTest.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

u256 dev::test::RandomCode::randomUniInt ( u256  _maxVal = 0)
static

Definition at line 259 of file fuzzHelper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string dev::test::RandomCode::randomUniIntHex ( u256  _maxVal = 0)
static

Generate random int64.

Definition at line 248 of file fuzzHelper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int dev::test::RandomCode::recursiveRLP ( std::string &  _result,
int  _depth,
std::string &  _debug 
)
staticprivate

Definition at line 45 of file fuzzHelper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void dev::test::RandomCode::refreshSeed ( )
staticprivate

Definition at line 267 of file fuzzHelper.cpp.

Here is the caller graph for this function:

std::string dev::test::RandomCode::rndByteSequence ( int  _length = 1,
SizeStrictness  _sizeType = SizeStrictness::Strict 
)
static

Generate random byte string of a given length.

Definition at line 191 of file fuzzHelper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string dev::test::RandomCode::rndRLPSequence ( int  _depth,
std::string &  _debug 
)
static

Generate random rlp byte sequence of a given depth (e.g [[[]],[]]).

max depth level = 20. The _debug string contains returned rlp string with analysed sections [] - length section/ or single byte rlp encoding () - decimal representation of length {1} - Array {2} - Array more than 55 {3} - List {4} - List more than 55

Definition at line 182 of file fuzzHelper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

boost::random::mt19937 dev::test::RandomCode::gen
staticprivate

Random generator.

Definition at line 109 of file fuzzHelper.h.

boostIntDistrib dev::test::RandomCode::opCodeDist = boostIntDistrib (0, 255)
staticprivate

0..255 opcodes

Definition at line 110 of file fuzzHelper.h.

boostIntDistrib dev::test::RandomCode::opLengDist = boostIntDistrib (1, 32)
staticprivate

1..32 byte string

Definition at line 111 of file fuzzHelper.h.

boostIntGenerator dev::test::RandomCode::randOpCodeGen = boostIntGenerator(gen, opCodeDist)
staticprivate

Generate random value from opCodeDist.

Definition at line 116 of file fuzzHelper.h.

boostIntGenerator dev::test::RandomCode::randOpLengGen = boostIntGenerator(gen, opLengDist)
staticprivate

Generate random length from opLengDist.

Definition at line 117 of file fuzzHelper.h.

boostUInt64Generator dev::test::RandomCode::randUInt64Gen = boostUInt64Generator(gen, uInt64Dist)
staticprivate

Generate random uInt64.

Definition at line 118 of file fuzzHelper.h.

boostIntGenerator dev::test::RandomCode::randUniIntGen = boostIntGenerator(gen, uniIntDist)
staticprivate

Generate random UniformInt from uniIntDist.

Definition at line 115 of file fuzzHelper.h.

boostUint64Distrib dev::test::RandomCode::uInt64Dist = boostUint64Distrib (0, std::numeric_limits<uint64_t>::max())
staticprivate

0..2**64

Definition at line 113 of file fuzzHelper.h.

boostIntDistrib dev::test::RandomCode::uniIntDist = boostIntDistrib (0, 0x7fffffff)
staticprivate

0..0x7fffffff

Definition at line 112 of file fuzzHelper.h.


The documentation for this class was generated from the following files: