11 static std::string IKey(
const std::string&
user_key,
19 static std::string Shorten(
const std::string& s,
const std::string& l) {
20 std::string result = s;
25 static std::string ShortSuccessor(
const std::string& s) {
26 std::string result = s;
31 static void TestKey(
const std::string& key,
34 std::string encoded = IKey(key, seq, vt);
40 ASSERT_EQ(key, decoded.user_key.ToString());
50 const char* keys[] = {
"",
"k",
"hello",
"longggggggggggggggggggggg" };
53 (1ull << 8) - 1, 1ull << 8, (1ull << 8) + 1,
54 (1ull << 16) - 1, 1ull << 16, (1ull << 16) + 1,
55 (1ull << 32) - 1, 1ull << 32, (1ull << 32) + 1
57 for (
int k = 0; k <
sizeof(keys) /
sizeof(keys[0]); k++) {
58 for (
int s = 0; s <
sizeof(seq) /
sizeof(seq[0]); s++) {
86 ASSERT_EQ(IKey(
"g", kMaxSequenceNumber, kValueTypeForSeek),
102 ASSERT_EQ(IKey(
"g", kMaxSequenceNumber, kValueTypeForSeek),
103 ShortSuccessor(IKey(
"foo", 100,
kTypeValue)));
105 ShortSuccessor(IKey(
"\xff\xff", 100,
kTypeValue)));
110 int main(
int argc,
char** argv) {
bool ParseInternalKey(const Slice &internal_key, ParsedInternalKey *result)
void AppendInternalKey(std::string *result, const ParsedInternalKey &key)
unsigned long long uint64_t
TEST(CorruptionTest, Recovery)
const Comparator * BytewiseComparator()