增加UT test

Signed-off-by: yanghui <yanghui152@huawei.com>
This commit is contained in:
yanghui 2023-12-02 03:28:51 +00:00 committed by Gitee
parent a47aef7732
commit f32dc74b0e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 10 additions and 4 deletions

View File

@ -50,8 +50,7 @@ constexpr auto IP_STATIC = "STATIC";
constexpr auto PROXY_STATIC = "STATIC";
constexpr auto PROXY_PAC = "PAC";
static const std::string DEFAULT_BSSID = "00:00:00:00:00:00";
static const std::string MULTICAST_MAC = "01:00:00:00:00:00";
static const std::string LOCALLY_ASSIGNED_MAC = "02:00:00:00:00:00";
static const std::string DEFAULT_MAC_ADDRESS = "02:00:00:00:00:00";
const std::unordered_map<std::string, WifiConfigType> g_wifiConfigMap = {
{XML_TAG_SSID, WifiConfigType::SSID},
@ -467,8 +466,7 @@ bool NetworkXmlParser::IsWifiConfigValid(WifiDeviceConfig wifiConfig)
bool NetworkXmlParser::IsRandomMacValid(WifiDeviceConfig wifiConfig)
{
if (wifiConfig.macAddress.empty() || wifiConfig.macAddress == MULTICAST_MAC ||
wifiConfig.macAddress == LOCALLY_ASSIGNED_MAC) {
if (wifiConfig.macAddress.empty() || wifiConfig.macAddress == DEFAULT_MAC_ADDRESS) {
return false;
}
return true;

View File

@ -184,6 +184,14 @@ HWTEST_F(NetworkParserTest, IsWifiConfigValidFalseTest, TestSize.Level1)
EXPECT_FALSE(m_networkXmlParser->IsWifiConfigValid(wifiConfig));
}
HWTEST_F(NetworkParserTest, IsRandomMacValidFalseTest, TestSize.Level1)
{
WIFI_LOGI("IsRandomMacValidFalseTest enter");
WifiDeviceConfig wifiConfig;
wifiConfig.macAddress = "02:00:00:00:00:00";
EXPECT_FALSE(m_networkXmlParser->IsRandomMacValid(wifiConfig));
}
HWTEST_F(NetworkParserTest, GetNetworksTest, TestSize.Level1)
{
WIFI_LOGI("GetNetworksTest enter");