1 /* 2 * Copyright (C) 2023 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 16 #include <gtest/gtest.h> 17 18 #include "dhcp_dhcpd.h" 19 #include "dhcp_s_server.h" 20 #include "dhcp_config.h" 21 #include "dhcp_logger.h" 22 23 DEFINE_DHCPLOG_DHCP_LABEL("DhcpDhcpdTest"); 24 25 using namespace testing::ext; 26 using namespace OHOS; 27 using namespace OHOS::DHCP; 28 namespace OHOS { 29 namespace DHCP { 30 class DhcpDhcpdTest : public testing::Test { 31 public: SetUpTestCase()32 static void SetUpTestCase() 33 {} TearDownTestCase()34 static void TearDownTestCase() 35 {} SetUp()36 virtual void SetUp() 37 { 38 } TearDown()39 virtual void TearDown() 40 { 41 } 42 private: 43 DhcpServerContext *m_pServerCtx = nullptr; 44 DhcpConfig m_serverConfg; 45 }; 46 47 HWTEST_F(DhcpDhcpdTest, StartDhcpServerMainTest, TestSize.Level1) 48 { 49 DHCP_LOGI("StartDhcpServerMainTest enter"); 50 std::string ifName = "wlan0"; 51 std::string netMask = "192.77.1.232"; 52 std::string ipRange; 53 std::string localIp = "192.77.1.232"; 54 EXPECT_EQ(1, StartDhcpServerMain(ifName, netMask, ipRange, localIp)); 55 } 56 57 HWTEST_F(DhcpDhcpdTest, RegisterDeviceConnectCallBackTest, TestSize.Level1) 58 { 59 DHCP_LOGI("RegisterDeviceConnectCallBackTest enter"); 60 DeviceConnectFun func = nullptr; 61 EXPECT_EQ(0, RegisterDeviceConnectCallBack(func)); 62 } 63 } 64 } 65