forked from weicao/cascadb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestutil.h
33 lines (24 loc) · 1.09 KB
/
testutil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
// This file is copied from LevelDB and modifed a little
// to add LevelDB style benchmark
#ifndef _CASCADB_BENCH_TESTUTIL_H_
#define _CASCADB_BENCH_TESTUTIL_H_
#include <string>
#include "cascadb/slice.h"
#include "random.h"
namespace cascadb {
// Store in *dst a random string of length "len" and return a Slice that
// references the generated data.
extern Slice RandomSlice(Random* rnd, size_t len, std::string* dst);
// Return a random key with the specified length that may contain interesting
// characters (e.g. \x00, \xff, etc.).
extern std::string RandomKey(Random* rnd, size_t len);
// Store in *dst a string of length "len" that will compress to
// "N*compressed_fraction" bytes and return a Slice that references
// the generated data.
extern Slice CompressibleSlice(Random* rnd, double compressed_fraction,
size_t len, std::string* dst);
}
#endif