summaryrefslogtreecommitdiffstats
path: root/storageapi/src/tests/buckets/bucketinfotest.cpp
blob: bc079ce8cad35c361e2f1a2c8eeb9794024bedb3 (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include <vespa/fastos/fastos.h>
#include <cppunit/extensions/HelperMacros.h>
#include <vespa/storageapi/buckets/bucketinfo.h>

namespace storage {
namespace api {

struct BucketInfo_Test : public CppUnit::TestFixture {

    void testSimple();

    CPPUNIT_TEST_SUITE(BucketInfo_Test);
    CPPUNIT_TEST(testSimple);
    CPPUNIT_TEST_SUITE_END();
};

CPPUNIT_TEST_SUITE_REGISTRATION(BucketInfo_Test);

/** Tests simple operations */
void BucketInfo_Test::testSimple()
{
    BucketInfo info;

    CPPUNIT_ASSERT_EQUAL(false, info.valid());
    CPPUNIT_ASSERT_EQUAL(0u, info.getChecksum());
    CPPUNIT_ASSERT_EQUAL(0u, info.getDocumentCount());
    CPPUNIT_ASSERT_EQUAL(1u, info.getTotalDocumentSize());

    info.setChecksum(0xa000bbbb);
    info.setDocumentCount(15);
    info.setTotalDocumentSize(64000);

    CPPUNIT_ASSERT_EQUAL(true, info.valid());
    CPPUNIT_ASSERT_EQUAL(0xa000bbbb, info.getChecksum());
    CPPUNIT_ASSERT_EQUAL(15u, info.getDocumentCount());
    CPPUNIT_ASSERT_EQUAL(64000u, info.getTotalDocumentSize());
};

} // api
} // storage