blob: 6abe5e66a0cb44e21e5e6acd24f0591faf866752 (
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
43
44
45
46
47
48
49
50
51
52
53
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/datatype/urldatatype.h>
#include <cppunit/extensions/HelperMacros.h>
namespace document {
class UrlTypeTest : public CppUnit::TestFixture {
public:
void requireThatNameIsCorrect();
void requireThatExpectedFieldsAreThere();
CPPUNIT_TEST_SUITE(UrlTypeTest);
CPPUNIT_TEST(requireThatNameIsCorrect);
CPPUNIT_TEST(requireThatExpectedFieldsAreThere);
CPPUNIT_TEST_SUITE_END();
};
CPPUNIT_TEST_SUITE_REGISTRATION(UrlTypeTest);
void
UrlTypeTest::requireThatNameIsCorrect()
{
const StructDataType &type = UrlDataType::getInstance();
CPPUNIT_ASSERT_EQUAL(vespalib::string("url"), type.getName());
}
void
UrlTypeTest::requireThatExpectedFieldsAreThere()
{
const StructDataType &type = UrlDataType::getInstance();
Field field = type.getField("all");
CPPUNIT_ASSERT_EQUAL(*DataType::STRING, field.getDataType());
field = type.getField("scheme");
CPPUNIT_ASSERT_EQUAL(*DataType::STRING, field.getDataType());
field = type.getField("host");
CPPUNIT_ASSERT_EQUAL(*DataType::STRING, field.getDataType());
field = type.getField("port");
CPPUNIT_ASSERT_EQUAL(*DataType::STRING, field.getDataType());
field = type.getField("path");
CPPUNIT_ASSERT_EQUAL(*DataType::STRING, field.getDataType());
field = type.getField("query");
CPPUNIT_ASSERT_EQUAL(*DataType::STRING, field.getDataType());
field = type.getField("fragment");
CPPUNIT_ASSERT_EQUAL(*DataType::STRING, field.getDataType());
}
} // document
|