chromium/third_party/leveldatabase/src/db/db_test.cc

// 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.

#include "leveldb/db.h"

#include <atomic>
#include <cinttypes>
#include <string>

#include "gtest/gtest.h"
#include "db/db_impl.h"
#include "db/filename.h"
#include "db/version_set.h"
#include "db/write_batch_internal.h"
#include "leveldb/cache.h"
#include "leveldb/env.h"
#include "leveldb/filter_policy.h"
#include "leveldb/table.h"
#include "port/port.h"
#include "port/thread_annotations.h"
#include "util/hash.h"
#include "util/logging.h"
#include "util/mutexlock.h"
#include "util/testutil.h"

namespace leveldb {

static std::string RandomString(Random* rnd, int len) {}

static std::string RandomKey(Random* rnd) {}

namespace {
class AtomicCounter {};

void DelayMilliseconds(int millis) {}

bool IsLdbFile(const std::string& f) {}

bool IsLogFile(const std::string& f) {}

bool IsManifestFile(const std::string& f) {}

}  // namespace

// Test Env to override default Env behavior for testing.
class TestEnv : public EnvWrapper {};

// Special Env used to delay background operations.
class SpecialEnv : public EnvWrapper {};

class DBTest : public testing::Test {};

TEST_F(DBTest, Empty) {}

TEST_F(DBTest, EmptyKey) {}

TEST_F(DBTest, EmptyValue) {}

TEST_F(DBTest, ReadWrite) {}

TEST_F(DBTest, PutDeleteGet) {}

TEST_F(DBTest, GetFromImmutableLayer) {}

TEST_F(DBTest, GetFromVersions) {}

TEST_F(DBTest, GetMemUsage) {}

TEST_F(DBTest, GetSnapshot) {}

TEST_F(DBTest, GetIdenticalSnapshots) {}

TEST_F(DBTest, IterateOverEmptySnapshot) {}

TEST_F(DBTest, GetLevel0Ordering) {}

TEST_F(DBTest, GetOrderedByLevels) {}

TEST_F(DBTest, GetPicksCorrectFile) {}

TEST_F(DBTest, GetEncountersEmptyLevel) {}

TEST_F(DBTest, IterEmpty) {}

TEST_F(DBTest, IterSingle) {}

TEST_F(DBTest, IterMulti) {}

TEST_F(DBTest, IterSmallAndLargeMix) {}

TEST_F(DBTest, IterMultiWithDelete) {}

TEST_F(DBTest, IterMultiWithDeleteAndCompaction) {}

TEST_F(DBTest, Recover) {}

TEST_F(DBTest, RecoveryWithEmptyLog) {}

// Check that writes done during a memtable compaction are recovered
// if the database is shutdown during the memtable compaction.
TEST_F(DBTest, RecoverDuringMemtableCompaction) {}

static std::string Key(int i) {}

TEST_F(DBTest, MinorCompactionsHappen) {}

TEST_F(DBTest, RecoverWithLargeLog) {}

TEST_F(DBTest, CompactionsGenerateMultipleFiles) {}

TEST_F(DBTest, RepeatedWritesToSameKey) {}

TEST_F(DBTest, SparseMerge) {}

static bool Between(uint64_t val, uint64_t low, uint64_t high) {}

TEST_F(DBTest, ApproximateSizes) {}

TEST_F(DBTest, ApproximateSizes_MixOfSmallAndLarge) {}

TEST_F(DBTest, IteratorPinsRef) {}

TEST_F(DBTest, Snapshot) {}

TEST_F(DBTest, HiddenValuesAreRemoved) {}

TEST_F(DBTest, DeletionMarkers1) {}

TEST_F(DBTest, DeletionMarkers2) {}

TEST_F(DBTest, OverlapInLevel0) {}

TEST_F(DBTest, L0_CompactionBug_Issue44_a) {}

TEST_F(DBTest, L0_CompactionBug_Issue44_b) {}

TEST_F(DBTest, Fflush_Issue474) {}

TEST_F(DBTest, ComparatorCheck) {}

TEST_F(DBTest, CustomComparator) {}

TEST_F(DBTest, ManualCompaction) {}

TEST_F(DBTest, DBOpen_Options) {}

TEST_F(DBTest, DestroyEmptyDir) {}

TEST_F(DBTest, DestroyOpenDB) {}

TEST_F(DBTest, Locking) {}

// Check that number of files does not grow when we are out of space
TEST_F(DBTest, NoSpace) {}

TEST_F(DBTest, NonWritableFileSystem) {}

TEST_F(DBTest, WriteSyncError) {}

TEST_F(DBTest, ManifestWriteError) {}

TEST_F(DBTest, MissingSSTFile) {}

TEST_F(DBTest, StillReadSST) {}

TEST_F(DBTest, FilesDeletedAfterCompaction) {}

TEST_F(DBTest, BloomFilter) {}

TEST_F(DBTest, LogCloseError) {}

// Multi-threaded test:
namespace {

static const int kNumThreads =;
static const int kTestSeconds =;
static const int kNumKeys =;

struct MTState {};

struct MTThread {};

static void MTThreadBody(void* arg) {}

}  // namespace

TEST_F(DBTest, MultiThreaded) {}

namespace {
KVMap;
}

class ModelDB : public DB {};

static bool CompareIterators(int step, DB* model, DB* db,
                             const Snapshot* model_snap,
                             const Snapshot* db_snap) {}

TEST_F(DBTest, Randomized) {}

}  // namespace leveldb