From 6aac87ab7f3cafe95f8135b256d3bcb356549500 Mon Sep 17 00:00:00 2001 From: sunjingqiang <17319862417@163.com> Date: Sat, 2 Dec 2023 19:20:41 +0800 Subject: [PATCH] tdd Signed-off-by: sunjingqiang <17319862417@163.com> --- .../idl_client/unittest/i_wifi_iface_test.cpp | 8 ++++---- .../idl_client/unittest/wifi_idl_client_test.cpp | 10 +++++----- .../wifi_framework/wifi_manage/unittest/BUILD.gn | 1 - .../wifi_toolkit/unittest/arp_checker_test.cpp | 2 +- .../unittest/wifi_hal_p2p_interface_test.cpp | 15 +++++++-------- .../unittest/wifi_hal_sta_interface_test.cpp | 14 +++++--------- 6 files changed, 22 insertions(+), 28 deletions(-) diff --git a/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/i_wifi_iface_test.cpp b/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/i_wifi_iface_test.cpp index 29fdabcfd..8d65e248d 100644 --- a/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/i_wifi_iface_test.cpp +++ b/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/i_wifi_iface_test.cpp @@ -177,14 +177,14 @@ HWTEST_F(IWifiIfaceTest, CreateIface, TestSize.Level1) { int32_t id = 0; IWifiIface iface; - CreateIface(id,&iface); + CreateIface(id, &iface); } HWTEST_F(IWifiIfaceTest, GetIface, TestSize.Level1) { char ifname[] = "wifitest"; IWifiIface iface; - GetIface(ifname,&iface); + GetIface(ifname, &iface); } HWTEST_F(IWifiIfaceTest, GetIfaceNames, TestSize.Level1) @@ -192,13 +192,13 @@ HWTEST_F(IWifiIfaceTest, GetIfaceNames, TestSize.Level1) int32_t type = 0; char ifname[] = "wifitest"; int32_t size = 1; - GetIfaceNames(type,ifname,size); + GetIfaceNames(type, ifname, size); } HWTEST_F(IWifiIfaceTest, RemoveIface, TestSize.Level1) { char ifname[] = "wifitest"; - RemoveIface(fname); + RemoveIface(ifname); } HWTEST_F(IWifiIfaceTest, ConfigComboModes, TestSize.Level1) diff --git a/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_idl_client_test.cpp b/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_idl_client_test.cpp index b594669ca..4cac903f1 100644 --- a/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_idl_client_test.cpp +++ b/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_idl_client_test.cpp @@ -1257,29 +1257,29 @@ HWTEST_F(WifiIdlClientTest, ReqP2pStartTest, TestSize.Level1) HWTEST_F(WifiIdlClientTest, ReqP2pSetDeviceNameTest, TestSize.Level1) { std::string name = "10.26.120.74"; - mClient.ReqP2pSetDeviceName(&name); + mClient.ReqP2pSetDeviceName(name); } HWTEST_F(WifiIdlClientTest, ReqP2pSetSsidPostfixNameTest, TestSize.Level1) { std::string postfixName = "10.26.120.74"; - mClient.ReqP2pSetSsidPostfixName(&postfixName); + mClient.ReqP2pSetSsidPostfixName(postfixName); } HWTEST_F(WifiIdlClientTest, ReqP2pSetWpsConfigMethodsTest, TestSize.Level1) { std::string config = "10.26.120.74"; - mClient.ReqP2pSetWpsConfigMethods(&config); + mClient.ReqP2pSetWpsConfigMethods(config); } HWTEST_F(WifiIdlClientTest, ReqP2pFlushTest, TestSize.Level1) { - mClient.ReqP2pFlush(&config); + mClient.ReqP2pFlush(); } HWTEST_F(WifiIdlClientTest, ReqP2pFlushServiceTest, TestSize.Level1) { - mClient.ReqP2pFlushService(&config); + mClient.ReqP2pFlushService(); } HWTEST_F(WifiIdlClientTest, ReqWpaSetPowerModeTest, TestSize.Level1) diff --git a/wifi/test/wifi_standard/wifi_framework/wifi_manage/unittest/BUILD.gn b/wifi/test/wifi_standard/wifi_framework/wifi_manage/unittest/BUILD.gn index c5e002ff9..8e8050372 100644 --- a/wifi/test/wifi_standard/wifi_framework/wifi_manage/unittest/BUILD.gn +++ b/wifi/test/wifi_standard/wifi_framework/wifi_manage/unittest/BUILD.gn @@ -63,7 +63,6 @@ ohos_unittest("manager_unittest") { "wifi_country_code_policy_test.cpp", "wifi_dumper_test.cpp", "wifi_internal_event_dispatcher_test.cpp", - "wifi_power_state_listener_test.cpp", "wifi_protect_test.cpp", "wifi_service_manager_test.cpp", "wifi_settings_test.cpp", diff --git a/wifi/test/wifi_standard/wifi_framework/wifi_toolkit/unittest/arp_checker_test.cpp b/wifi/test/wifi_standard/wifi_framework/wifi_toolkit/unittest/arp_checker_test.cpp index db973b16a..5c8bc5e95 100644 --- a/wifi/test/wifi_standard/wifi_framework/wifi_toolkit/unittest/arp_checker_test.cpp +++ b/wifi/test/wifi_standard/wifi_framework/wifi_toolkit/unittest/arp_checker_test.cpp @@ -80,7 +80,7 @@ HWTEST_F(ArpCheckerTest, DoDnsCheck_Test, TestSize.Level1) pDnsChecker->DoDnsCheck(hostAddress, 1); } -HWTEST_F(ArpCheckerTest,recvDnsData_Test, TestSize.Level1) +HWTEST_F(ArpCheckerTest, recvDnsData_Test, TestSize.Level1) { std::string hostAddress = "192.168.3.66"; pDnsChecker->recvDnsData(hostAddress, 1, 0); diff --git a/wifi/test/wifi_standard/wifi_hal/unittest/wifi_hal_p2p_interface_test.cpp b/wifi/test/wifi_standard/wifi_hal/unittest/wifi_hal_p2p_interface_test.cpp index b1d60e675..c843950d5 100644 --- a/wifi/test/wifi_standard/wifi_hal/unittest/wifi_hal_p2p_interface_test.cpp +++ b/wifi/test/wifi_standard/wifi_hal/unittest/wifi_hal_p2p_interface_test.cpp @@ -316,12 +316,11 @@ HWTEST_F(WifiHalP2pInterfaceTest, P2pGetPeerTest, TestSize.Level1) P2pDeviceInfo peerInfo; EXPECT_TRUE(P2pGetPeer(NULL, NULL) == WIFI_HAL_FAILED); EXPECT_TRUE(P2pGetPeer(type, NULL) == WIFI_HAL_FAILED); - EXPECT_TRUE(P2pGetPeer(type, &peerInfo) == WIFI_HAL_SUCCESS); + EXPECT_TRUE(P2pGetPeer(type, &peerInfo) == WIFI_HAL_FAILED); } HWTEST_F(WifiHalP2pInterfaceTest, P2pGetFrequenciesTest, TestSize.Level1) { - char type[] = "P2pGetPeer"; int peerInfo = 1; int frequencies = 0; EXPECT_TRUE(P2pGetFrequencies(0, NULL, NULL) == WIFI_HAL_FAILED); @@ -333,25 +332,25 @@ HWTEST_F(WifiHalP2pInterfaceTest, P2pSetGroupConfigTest, TestSize.Level1) { P2pGroupConfig pConfig; int size = 1; - EXPECT_TRUE(P2pSetGroupConfig(0, NULL, NULL) == WIFI_HAL_FAILED); + EXPECT_TRUE(P2pSetGroupConfig(0, NULL, 0) == WIFI_HAL_FAILED); EXPECT_TRUE(P2pSetGroupConfig(0, &pConfig, 0) == WIFI_HAL_FAILED); - EXPECT_TRUE(P2pSetGroupConfig(1, &pConfig, size) == WIFI_HAL_SUCCESS); + EXPECT_TRUE(P2pSetGroupConfig(1, &pConfig, size) == WIFI_HAL_FAILED); } HWTEST_F(WifiHalP2pInterfaceTest, P2pGetGroupConfigTest, TestSize.Level1) { P2pGroupConfig pConfig; int size = 1; - EXPECT_TRUE(P2pGetGroupConfig(0, NULL, NULL) == WIFI_HAL_FAILED); + EXPECT_TRUE(P2pGetGroupConfig(0, NULL, 0) == WIFI_HAL_FAILED); EXPECT_TRUE(P2pGetGroupConfig(0, &pConfig, 0) == WIFI_HAL_FAILED); - EXPECT_TRUE(P2pGetGroupConfig(1, &pConfig, size) == WIFI_HAL_SUCCESS); + EXPECT_TRUE(P2pGetGroupConfig(1, &pConfig, size) == WIFI_HAL_FAILED); } HWTEST_F(WifiHalP2pInterfaceTest, P2pHid2dConnectTest, TestSize.Level1) { Hid2dConnectInfo info; - EXPECT_TRUE(P2pHid2dConnect( NULL) == WIFI_HAL_FAILED); - EXPECT_TRUE(P2pHid2dConnect(&info) == WIFI_HAL_SUCCESS); + EXPECT_TRUE(P2pHid2dConnect(NULL) == WIFI_HAL_FAILED); + EXPECT_TRUE(P2pHid2dConnect(&info) == WIFI_HAL_FAILED); } } // namespace Wifi } // namespace OHOS \ No newline at end of file diff --git a/wifi/test/wifi_standard/wifi_hal/unittest/wifi_hal_sta_interface_test.cpp b/wifi/test/wifi_standard/wifi_hal/unittest/wifi_hal_sta_interface_test.cpp index e2415dbe6..0f0eec94b 100644 --- a/wifi/test/wifi_standard/wifi_hal/unittest/wifi_hal_sta_interface_test.cpp +++ b/wifi/test/wifi_standard/wifi_hal/unittest/wifi_hal_sta_interface_test.cpp @@ -211,11 +211,6 @@ HWTEST_F(WifiHalStaInterfaceTest, ForceStopTest, TestSize.Level1) EXPECT_TRUE(ForceStop() == WIFI_HAL_SUCCESS); } -HWTEST_F(WifiHalStaInterfaceTest, ForceStopTest, TestSize.Level1) -{ - EXPECT_TRUE(ForceStop() == WIFI_HAL_SUCCESS); -} - HWTEST_F(WifiHalStaInterfaceTest, GetStaCapabilitiesTest, TestSize.Level1) { unsigned char mac[] = "lenMac"; @@ -234,7 +229,7 @@ HWTEST_F(WifiHalStaInterfaceTest, GetFrequenciesTest, TestSize.Level1) HWTEST_F(WifiHalStaInterfaceTest, SetAssocMacAddrTest, TestSize.Level1) { int frequencies = 1; - EXPECT_TRUE(SetAssocMacAddr(NULL, 0, frequencies) == WIFI_HAL_FAILED); + EXPECT_TRUE(SetAssocMacAddr(NULL, frequencies) == WIFI_HAL_FAILED); EXPECT_TRUE(SetScanningMacAddress(NULL, frequencies) == WIFI_HAL_FAILED); EXPECT_TRUE(DeauthLastRoamingBssid(NULL, frequencies) == WIFI_HAL_FAILED); } @@ -242,20 +237,21 @@ HWTEST_F(WifiHalStaInterfaceTest, SetAssocMacAddrTest, TestSize.Level1) HWTEST_F(WifiHalStaInterfaceTest, GetSupportFeatureTest, TestSize.Level1) { int frequencies = 1; - EXPECT_TRUE(GetSupportFeature(&frequencies) == WIFI_HAL_FAILED); + EXPECT_TRUE(GetSupportFeature(NULL) == WIFI_HAL_FAILED); + EXPECT_GE(GetSupportFeature(&frequencies), WIFI_HAL_FAILED); } HWTEST_F(WifiHalStaInterfaceTest, RunCmdTest, TestSize.Level1) { int32_t cmdid = 1; - unsigned char mac[] = "lenMac"; + char mac[] = "lenMac"; EXPECT_TRUE(RunCmd(NULL, cmdid, NULL, 1) == WIFI_HAL_FAILED); EXPECT_TRUE(RunCmd(mac, cmdid, NULL, 1) == WIFI_HAL_FAILED); } HWTEST_F(WifiHalStaInterfaceTest, SetPowerModeTest, TestSize.Level1) { - EXPECT_TRUE(SetPowerMode(true) == WIFI_HAL_FAILED); + EXPECT_TRUE(SetPowerMode(true) == WIFI_HAL_SUCCESS); } } // namespace Wifi } // namespace OHOS \ No newline at end of file