补偿代码差异

Signed-off-by: wangzhaohao <wangzhaohao@huawei.com>
This commit is contained in:
wangzhaohao 2024-07-13 16:24:11 +08:00
parent 14e47c6019
commit 64935b05cb
3 changed files with 74 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2023 Huawei Device Co., Ltd.
<!-- Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -410,7 +410,7 @@ HWTEST_F(DistributedDeviceProfileClientKvTest, OnServiceDied001, TestSize.Level1
OHOS::wptr<OHOS::IRemoteObject> remsotes = nullptr;
DistributedDeviceProfileClient::DeviceProfileDeathRecipient deathRecipient;
deathRecipient.OnRemoteDied(remsotes);
OHOS::sptr<OHOS::IRemoteObject> remote = nullptr;
DistributedDeviceProfileClient::GetInstance().OnServiceDied(remote);
EXPECT_EQ(nullptr, DistributedDeviceProfileClient::GetInstance().dpProxy_);

View File

@ -1017,6 +1017,16 @@ HWTEST_F(ProfileUtilsTest, IsPropertyValid001, TestSize.Level1)
int32_t minValue = 0;
bool res2 = ProfileUtils::IsPropertyValid(propertyMap, property, minValue, maxValue);
EXPECT_EQ(false, res2);
uint32_t u32MinValue = 0;
uint32_t u32MaxValue = 1;
bool res3 = ProfileUtils::IsPropertyValid(propertyMap, property, u32MinValue, u32MaxValue);
EXPECT_EQ(false, res3);
int64_t i64MinValue = 0;
int64_t i64MaxValue = 1;
bool res4 = ProfileUtils::IsPropertyValid(propertyMap, property, i64MinValue, i64MaxValue);
EXPECT_EQ(false, res4);
}
/**
@ -1080,6 +1090,68 @@ HWTEST_F(ProfileUtilsTest, IsPropertyValid003, TestSize.Level1)
EXPECT_EQ(false, res4);
}
/**
* @tc.name: IsPropertyValid004
* @tc.desc: IsPropertyValid overload 3.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(ProfileUtilsTest, IsPropertyValid004, TestSize.Level1)
{
map<string, string> propertyMap;
string property = "property";
string value = "5";
propertyMap[property] = value;
uint32_t maxValue = 10;
uint32_t minValue = 0;
bool res1 = ProfileUtils::IsPropertyValid(propertyMap, property, minValue, maxValue);
EXPECT_EQ(true, res1);
maxValue = 0;
bool res2 = ProfileUtils::IsPropertyValid(propertyMap, property, minValue, maxValue);
EXPECT_EQ(false, res2);
value = "0";
propertyMap[property] = value;
bool res3 = ProfileUtils::IsPropertyValid(propertyMap, property, minValue, maxValue);
EXPECT_EQ(false, res3);
propertyMap.erase(property);
bool res4 = ProfileUtils::IsPropertyValid(propertyMap, property, minValue, maxValue);
EXPECT_EQ(false, res4);
}
/**
* @tc.name: IsPropertyValid005
* @tc.desc: IsPropertyValid overload 4.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(ProfileUtilsTest, IsPropertyValid005, TestSize.Level1)
{
map<string, string> propertyMap;
string property = "property";
string value = "5";
propertyMap[property] = value;
int64_t maxValue = 10;
int64_t minValue = 0;
bool res1 = ProfileUtils::IsPropertyValid(propertyMap, property, minValue, maxValue);
EXPECT_EQ(true, res1);
maxValue = 0;
bool res2 = ProfileUtils::IsPropertyValid(propertyMap, property, minValue, maxValue);
EXPECT_EQ(false, res2);
value = "0";
propertyMap[property] = value;
bool res3 = ProfileUtils::IsPropertyValid(propertyMap, property, minValue, maxValue);
EXPECT_EQ(false, res3);
propertyMap.erase(property);
bool res4 = ProfileUtils::IsPropertyValid(propertyMap, property, minValue, maxValue);
EXPECT_EQ(false, res4);
}
/**
* @tc.name: GetIntValue001
* @tc.desc: GetIntValue failed, ValuesBucket is empty.