leveldb: Add tests for empty keys and values.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=239695281
This commit is contained in:
parent
7035af5fc3
commit
6188a54ce9
@ -558,6 +558,26 @@ TEST(DBTest, Empty) {
|
|||||||
} while (ChangeOptions());
|
} while (ChangeOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(DBTest, EmptyKey) {
|
||||||
|
do {
|
||||||
|
ASSERT_OK(Put("", "v1"));
|
||||||
|
ASSERT_EQ("v1", Get(""));
|
||||||
|
ASSERT_OK(Put("", "v2"));
|
||||||
|
ASSERT_EQ("v2", Get(""));
|
||||||
|
} while (ChangeOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(DBTest, EmptyValue) {
|
||||||
|
do {
|
||||||
|
ASSERT_OK(Put("key", "v1"));
|
||||||
|
ASSERT_EQ("v1", Get("key"));
|
||||||
|
ASSERT_OK(Put("key", ""));
|
||||||
|
ASSERT_EQ("", Get("key"));
|
||||||
|
ASSERT_OK(Put("key", "v2"));
|
||||||
|
ASSERT_EQ("v2", Get("key"));
|
||||||
|
} while (ChangeOptions());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(DBTest, ReadWrite) {
|
TEST(DBTest, ReadWrite) {
|
||||||
do {
|
do {
|
||||||
ASSERT_OK(Put("foo", "v1"));
|
ASSERT_OK(Put("foo", "v1"));
|
||||||
|
Loading…
Reference in New Issue
Block a user