aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/tests/fieldvalue/fieldvalue_test.cpp
blob: e78509143ad24f19016bb1881d1098dd0795e548 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Unit tests for fieldvalue.

#include <vespa/document/fieldvalue/stringfieldvalue.h>
#include <vespa/document/fieldvalue/longfieldvalue.h>
#include <vespa/document/fieldvalue/intfieldvalue.h>

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

#include <vespa/log/log.h>
LOG_SETUP("fieldvalue_test");

using namespace document;

namespace {

TEST("require that StringFieldValue can be assigned primitives") {
    StringFieldValue val;
    val = "foo";
    EXPECT_EQUAL("foo", val.getValue());
}

TEST("require that FieldValues does not change their storage size.") {
    EXPECT_EQUAL(16u, sizeof(FieldValue));
    EXPECT_EQUAL(16u, sizeof(IntFieldValue));
    EXPECT_EQUAL(24u, sizeof(LongFieldValue));
    EXPECT_EQUAL(104u, sizeof(StringFieldValue));
}

}  // namespace

TEST_MAIN() { TEST_RUN_ALL(); }