blob: b7b32118fee41c1422131a327fc29897bba5c6ac (
plain) (
blame)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/storage/bucketdb/bucketdatabase.h>
#include <vespa/storage/storageutil/utils.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/util/document_runnable.h>
#include <cppunit/extensions/HelperMacros.h>
#define SETUP_DATABASE_TESTS() \
CPPUNIT_TEST(testUpdateGetAndRemove); \
CPPUNIT_TEST(testClear); \
CPPUNIT_TEST(testIterating); \
CPPUNIT_TEST(testFindParents); \
CPPUNIT_TEST(testFindAll); \
CPPUNIT_TEST(testCreateAppropriateBucket); \
CPPUNIT_TEST(testGetNext); \
CPPUNIT_TEST(testGetNextReturnsUpperBoundBucket); \
CPPUNIT_TEST(testUpperBoundReturnsNextInOrderGreaterBucket); \
CPPUNIT_TEST(testChildCount);
namespace storage {
namespace distributor {
struct BucketDatabaseTest : public CppUnit::TestFixture {
void setUp() override ;
void testUpdateGetAndRemove();
void testClear();
void testIterating();
void testFindParents();
void testFindAll();
void testCreateAppropriateBucket();
void testGetNext();
void testGetNextReturnsUpperBoundBucket();
void testUpperBoundReturnsNextInOrderGreaterBucket();
void testChildCount();
void testBenchmark();
std::string doFindParents(const std::vector<document::BucketId>& ids,
const document::BucketId& searchId);
std::string doFindAll(const std::vector<document::BucketId>& ids,
const document::BucketId& searchId);
document::BucketId doCreate(const std::vector<document::BucketId>& ids,
uint32_t minBits,
const document::BucketId& wantedId);
virtual BucketDatabase& db() = 0;
private:
using UBoundFunc = std::function<
document::BucketId(const BucketDatabase&,
const document::BucketId&)>;
void doTestUpperBound(const UBoundFunc& f);
};
}
}
|