summaryrefslogtreecommitdiff
path: root/src/test/DBusClientIdTest.cpp
blob: 38d9d295010bd04093594280a79a6bd32857c3ce (plain)
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
54
55
56
57
58
59
// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include <gtest/gtest.h>

#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
#endif

#include "CommonAPI/DBus/DBusClientId.hpp"
#include "CommonAPI/Types.hpp"

using namespace CommonAPI::DBus;

class DBusClientIdTest: public ::testing::Test {

public:
    void SetUp() {

    }

    void TearDown() {

    }
};

class TestClientId: public CommonAPI::ClientId {
public:
    bool operator==(CommonAPI::ClientId& clientIdToCompare) {
        return false; // doesn't matter, as we are just comparing this class with DBusClientId;
    }

    std::size_t hashCode() {
        return 0;
    }

};

TEST_F(DBusClientIdTest, TestClientIdImplementation) {
    DBusClientId dbusId1("test1");
    DBusClientId dbusId2("test2");
    TestClientId testId;


    ASSERT_TRUE(dbusId1 == dbusId1);
    ASSERT_FALSE(dbusId1 == dbusId2);
    ASSERT_FALSE(dbusId2 == dbusId1);

    ASSERT_FALSE(dbusId1 == testId);
}

#ifndef __NO_MAIN__
int main(int argc, char** argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}
#endif