summaryrefslogtreecommitdiffstats
path: root/vbench/src/tests/writable_memory/writable_memory_test.cpp
blob: 2be9d6b51538f6aa0e3c3c36ba71514b2b57bd65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
#include <vbench/test/all.h>

using namespace vbench;

TEST("empty") {
    WritableMemory wm;
    EXPECT_EQUAL((char*)0, wm.data);
    EXPECT_EQUAL(0u, wm.size);
}

TEST("from buffer") {
    char buf[3];
    WritableMemory wm(buf, 3);
    EXPECT_EQUAL(buf, wm.data);
    EXPECT_EQUAL(3u, wm.size);
}

TEST_MAIN() { TEST_RUN_ALL(); }