summaryrefslogtreecommitdiffstats
path: root/document/src/tests/urltypetest.cpp
blob: ebcbcbf6b7a65f047e0db697b207d45cf2b933c5 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/datatype/urldatatype.h>
#include <gtest/gtest.h>

namespace document {

TEST(UrlTypeTest, requireThatNameIsCorrect)
{
    const StructDataType &type = UrlDataType::getInstance();
    EXPECT_EQ(vespalib::string("url"), type.getName());
}

TEST(UrlTypeTest, requireThatExpectedFieldsAreThere)
{
    const StructDataType &type = UrlDataType::getInstance();
    Field field = type.getField("all");
    EXPECT_EQ(*DataType::STRING, field.getDataType());

    field = type.getField("scheme");
    EXPECT_EQ(*DataType::STRING, field.getDataType());

    field = type.getField("host");
    EXPECT_EQ(*DataType::STRING, field.getDataType());

    field = type.getField("port");
    EXPECT_EQ(*DataType::STRING, field.getDataType());

    field = type.getField("path");
    EXPECT_EQ(*DataType::STRING, field.getDataType());

    field = type.getField("query");
    EXPECT_EQ(*DataType::STRING, field.getDataType());

    field = type.getField("fragment");
    EXPECT_EQ(*DataType::STRING, field.getDataType());
}

} // document