MCPcopy Create free account
hub / github.com/ElementsProject/elements / CompressibleString

Function CompressibleString

src/leveldb/util/testutil.cc:32–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32Slice CompressibleString(Random* rnd, double compressed_fraction, size_t len,
33 std::string* dst) {
34 int raw = static_cast<int>(len * compressed_fraction);
35 if (raw < 1) raw = 1;
36 std::string raw_data;
37 RandomString(rnd, raw, &raw_data);
38
39 // Duplicate the random data until we have filled "len" bytes
40 dst->clear();
41 while (dst->size() < len) {
42 dst->append(raw_data);
43 }
44 dst->resize(len);
45 return Slice(*dst);
46}
47
48} // namespace test
49} // namespace leveldb

Callers 4

TESTFunction · 0.85
RandomGeneratorMethod · 0.85
RandomGeneratorMethod · 0.85
RandomGeneratorMethod · 0.85

Calls 5

RandomStringFunction · 0.70
SliceClass · 0.70
clearMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected