aboutsummaryrefslogtreecommitdiffstats
path: root/vbench/src/tests/server_spec/server_spec_test.cpp
blob: fb535e87ba2b94e2dce7af2baa360342b86a319d (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 Yahoo. 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") {
    ServerSpec spec;
    EXPECT_EQUAL("", spec.host);
    EXPECT_EQUAL(0, spec.port);
}

TEST("standard") {
    ServerSpec spec("foo", 3);
    EXPECT_EQUAL("foo", spec.host);
    EXPECT_EQUAL(3, spec.port);
}

TEST("compare") {
    ServerSpec spec0("foo", 3);
    ServerSpec spec1("foo", 3);
    ServerSpec spec2("bar", 3);
    ServerSpec spec3("foo", 4);
    ServerSpec spec4("bar", 4);
    EXPECT_TRUE(spec0 == spec1);
    EXPECT_TRUE(spec1 == spec0);
    EXPECT_FALSE(spec0 == spec2);
    EXPECT_FALSE(spec2 == spec0);
    EXPECT_TRUE(spec2 < spec0);
    EXPECT_TRUE(spec0 < spec3);
    EXPECT_TRUE(spec0 < spec4);
    EXPECT_FALSE(spec0 < spec1);
    EXPECT_FALSE(spec0 < spec2);
    EXPECT_FALSE(spec3 < spec0);
    EXPECT_FALSE(spec4 < spec0);
}

TEST_MAIN() { TEST_RUN_ALL(); }