blob: 8a149b21b482b40146c2d63d23f690e92a0a1474 (
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/messagebus/network/identity.h>
using namespace mbus;
TEST_SETUP(Test);
int
Test::Main()
{
TEST_INIT("identity_test");
Identity ident("foo/bar/baz");
EXPECT_TRUE(ident.getServicePrefix() == "foo/bar/baz");
{
std::vector<string> tmp = Identity::split("foo/bar/baz");
ASSERT_TRUE(tmp.size() == 3);
EXPECT_TRUE(tmp[0] == "foo");
EXPECT_TRUE(tmp[1] == "bar");
EXPECT_TRUE(tmp[2] == "baz");
}
{
std::vector<string> tmp = Identity::split("//");
ASSERT_TRUE(tmp.size() == 3);
EXPECT_TRUE(tmp[0] == "");
EXPECT_TRUE(tmp[1] == "");
EXPECT_TRUE(tmp[2] == "");
}
{
std::vector<string> tmp = Identity::split("foo");
ASSERT_TRUE(tmp.size() == 1);
EXPECT_TRUE(tmp[0] == "foo");
}
{
std::vector<string> tmp = Identity::split("");
ASSERT_TRUE(tmp.size() == 1);
EXPECT_TRUE(tmp[0] == "");
}
TEST_DONE();
}
|