• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include <cstring>
16 #include <gtest/gtest.h>
17 #include <securec.h>
18 
19 #include "softbus_common.h"
20 #include "client_bus_center_manager.c"
21 
22 namespace OHOS {
23 using namespace testing::ext;
24 
25 
26 class ClientBusMangerTest : public testing::Test {
27 public:
28     static void SetUpTestCase();
29     static void TearDownTestCase();
30     void SetUp();
31     void TearDown();
32 };
33 
SetUpTestCase()34 void ClientBusMangerTest::SetUpTestCase()
35 {
36 }
37 
TearDownTestCase()38 void ClientBusMangerTest::TearDownTestCase()
39 {
40 }
41 
SetUp()42 void ClientBusMangerTest::SetUp()
43 {
44     BusCenterClientInit();
45 }
46 
TearDown()47 void ClientBusMangerTest::TearDown()
48 {
49 }
50 
51 /*
52 * @tc.name: IS_SAME_CONNECTION_ADDR
53 * @tc.desc: PreLink lane test
54 * @tc.type: FUNC
55 * @tc.require: AR000FN5VC
56 */
57 HWTEST_F(ClientBusMangerTest, IS_SAME_CONNECTION_ADDR_Test_001, TestSize.Level1)
58 {
59     const ConnectionAddr addr1 = {
60         .type = CONNECTION_ADDR_MAX,
61         .info.session.sessionId = 1,
62     };
63     const ConnectionAddr addr2 = {
64         .type = CONNECTION_ADDR_SESSION,
65         .info.session.sessionId = 2,
66     };
67     int32_t ret = IsSameConnectionAddr(&addr1, &addr2);
68     EXPECT_TRUE(ret == false);
69     const ConnectionAddr addr3 = {
70         .type = CONNECTION_ADDR_SESSION,
71         .info.session.sessionId = 1,
72     };
73     ret = IsSameConnectionAddr(&addr3, &addr2);
74     EXPECT_TRUE(ret == false);
75 }
76 }