Skip to content

Instantly share code, notes, and snippets.

@fuzz-ai
Created January 2, 2019 06:37
Show Gist options
  • Select an option

  • Save fuzz-ai/f053f0be7c38715c6f9c32735d1409bf to your computer and use it in GitHub Desktop.

Select an option

Save fuzz-ai/f053f0be7c38715c6f9c32735d1409bf to your computer and use it in GitHub Desktop.
fuzzed version of testStress()
while (!std::cin.eof() )
{
// pick a random ledger history
std::string curr = "";
char depth = getBits( maxDepth );
char offset = 0;
for(char d = 0; d < depth; ++d)
{
char a = offset + getBits( maxWidth );
curr += a;
offset = (a + 1) * maxWidth;
}
// 50-50 to add remove
if(getBits(2) == 0)
t.insert(h[curr]);
else
t.remove(h[curr]);
assert( t.checkInvariants() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment