aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp
blob: 0a616745023d4019c9bd4406ac731fbf0a3b1c13 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/growablebytebuffer.h>

using namespace vespalib;

class Test : public TestApp
{
public:
    void testGrowing();
    int Main() override;
};

void
Test::testGrowing()
{
    GrowableByteBuffer buf(10);

    buf.putInt(3);
    buf.putInt(7);
    buf.putLong(1234);
    buf.putDouble(1234);
    buf.putString("hei der");

    EXPECT_EQUAL(35u, buf.position());
}

int
Test::Main()
{
    TEST_INIT("guard_test");
    testGrowing();
    TEST_DONE();
}

TEST_APPHOOK(Test)