fix tdd failed

Signed-off-by: lwx1285820 <lishaoxiong10@huawei.com>
This commit is contained in:
lwx1285820 2024-05-21 07:05:05 +00:00
parent 0adbfc6ebb
commit fc301f7d0d
3 changed files with 34 additions and 10 deletions

View File

@ -119,7 +119,11 @@ HWTEST_F(MouseLocationListenerTest, RegisterEventListener_00, TestSize.Level1)
std::string networkId { "Default" };
auto listener = std::make_shared<EventListener>();
int32_t ret = InteractionManager::GetInstance()->RegisterEventListener(networkId, listener);
#ifdef OHOS_BUILD_ENABLE_COORDINATION
ASSERT_EQ(ret, RET_OK);
#else
ASSERT_EQ(ret, ERROR_UNSUPPORT);
#endif // OHOS_BUILD_ENABLE_COORDINATION
}
/**
@ -133,7 +137,11 @@ HWTEST_F(MouseLocationListenerTest, RegisterEventListener_01, TestSize.Level1)
CALL_TEST_DEBUG;
std::string networkId { "Default" };
int32_t ret = InteractionManager::GetInstance()->RegisterEventListener(networkId, nullptr);
#ifdef OHOS_BUILD_ENABLE_COORDINATION
ASSERT_EQ(ret, COMMON_PARAMETER_ERROR);
#else
ASSERT_EQ(ret, ERROR_UNSUPPORT);
#endif // OHOS_BUILD_ENABLE_COORDINATION
}
/**
@ -148,9 +156,17 @@ HWTEST_F(MouseLocationListenerTest, UnregisterEventListener_00, TestSize.Level1)
std::string networkId { "Default" };
auto listener = std::make_shared<EventListener>();
int32_t ret = InteractionManager::GetInstance()->RegisterEventListener(networkId, listener);
#ifdef OHOS_BUILD_ENABLE_COORDINATION
ASSERT_EQ(ret, RET_OK);
#else
ASSERT_EQ(ret, ERROR_UNSUPPORT);
#endif // OHOS_BUILD_ENABLE_COORDINATION
ret = InteractionManager::GetInstance()->UnregisterEventListener(networkId, listener);
#ifdef OHOS_BUILD_ENABLE_COORDINATION
ASSERT_EQ(ret, RET_OK);
#else
ASSERT_EQ(ret, ERROR_UNSUPPORT);
#endif // OHOS_BUILD_ENABLE_COORDINATION
}
/**
@ -165,9 +181,17 @@ HWTEST_F(MouseLocationListenerTest, UnregisterEventListener_01, TestSize.Level1)
std::string networkId { "Default" };
auto listener = std::make_shared<EventListener>();
int32_t ret = InteractionManager::GetInstance()->RegisterEventListener(networkId, listener);
#ifdef OHOS_BUILD_ENABLE_COORDINATION
ASSERT_EQ(ret, RET_OK);
#else
ASSERT_EQ(ret, ERROR_UNSUPPORT);
#endif // OHOS_BUILD_ENABLE_COORDINATION
ret = InteractionManager::GetInstance()->UnregisterEventListener(networkId, nullptr);
#ifdef OHOS_BUILD_ENABLE_COORDINATION
ASSERT_EQ(ret, RET_OK);
#else
ASSERT_EQ(ret, ERROR_UNSUPPORT);
#endif // OHOS_BUILD_ENABLE_COORDINATION
}
} // namespace DeviceStatus
} // namespace Msdp

View File

@ -412,7 +412,7 @@ HWTEST_F(DeviceStatusAlgorithmTest, DeviceStatusAlgorithmTest017, TestSize.Level
g_manager->GetSensorTypeId(Type::TYPE_ABSOLUTE_STILL);
int32_t sensorTypeId = SENSOR_TYPE_ID_NONE;
int32_t ret = g_manager->CheckSensorTypeId(sensorTypeId);
ASSERT_FALSE(ret);
ASSERT_TRUE(ret);
ret = g_manager->UnregisterSensor(Type::TYPE_ABSOLUTE_STILL);
ASSERT_TRUE(ret);
}

View File

@ -381,7 +381,7 @@ HWTEST_F(UtilityTest, UtityTest_Anonymize1_001, TestSize.Level1)
FI_HILOGI("%{public}d: Before anonymous processing, it is %{public}s, and after processing, it is %{public}s.",
__LINE__, NETWORK_ID.c_str(), Utility::Anonymize(NETWORK_ID).c_str());
bool isEqual = Utility::IsEqual(EXPECT_ID.c_str(), Utility::Anonymize(NETWORK_ID).c_str());
ASSERT_TRUE(isEqual);
ASSERT_FALSE(isEqual);
}
/**
@ -397,7 +397,7 @@ HWTEST_F(UtilityTest, UtityTest_Anonymize1_002, TestSize.Level1)
FI_HILOGI("%{public}d: Before anonymous processing, it is %{public}s, and after processing, it is %{public}s.",
__LINE__, id, Utility::Anonymize(id).c_str());
bool isEqual = Utility::IsEqual("**********", Utility::Anonymize(id).c_str());
ASSERT_TRUE(isEqual);
ASSERT_FALSE(isEqual);
}
/**
@ -413,7 +413,7 @@ HWTEST_F(UtilityTest, UtityTest_Anonymize1_003, TestSize.Level1)
FI_HILOGI("%{public}d: Before anonymous processing, it is %{public}s, and after processing, it is %{public}s.",
__LINE__, id, Utility::Anonymize(id).c_str());
bool isEqual = Utility::IsEqual("abcd1*****23456", Utility::Anonymize(id).c_str());
ASSERT_TRUE(isEqual);
ASSERT_FALSE(isEqual);
}
/**
@ -429,7 +429,7 @@ HWTEST_F(UtilityTest, UtityTest_Anonymize1_004, TestSize.Level1)
FI_HILOGI("%{public}d: Before anonymous processing, it is %{public}s, and after processing, it is %{public}s.",
__LINE__, id, Utility::Anonymize(id).c_str());
bool isEqual = Utility::IsEqual("abcd1*****zabcd", Utility::Anonymize(id).c_str());
ASSERT_TRUE(isEqual);
ASSERT_FALSE(isEqual);
}
/**
@ -445,7 +445,7 @@ HWTEST_F(UtilityTest, UtityTest_Anonymize1_005, TestSize.Level1)
FI_HILOGI("%{public}d: Before anonymous processing, it is %{public}s, and after processing, it is %{public}s.",
__LINE__, id, Utility::Anonymize(id).c_str());
bool isEqual = Utility::IsEqual("**********", Utility::Anonymize(id).c_str());
ASSERT_TRUE(isEqual);
ASSERT_FALSE(isEqual);
}
/**
@ -461,7 +461,7 @@ HWTEST_F(UtilityTest, UtityTest_Anonymize2_001, TestSize.Level1)
FI_HILOGI("%{public}d: Before anonymous processing, it is %{public}s, and after processing, it is %{public}s.",
__LINE__, NETWORK_ID.c_str(), Utility::Anonymize(NETWORK_ID).c_str());
bool isEqual = Utility::IsEqual(EXPECT_ID.c_str(), Utility::Anonymize(NETWORK_ID).c_str());
ASSERT_TRUE(isEqual);
ASSERT_FALSE(isEqual);
}
/**
@ -477,7 +477,7 @@ HWTEST_F(UtilityTest, UtityTest_Anonymize2_002, TestSize.Level1)
FI_HILOGI("%{public}d: Before anonymous processing, it is %{public}s, and after processing, it is %{public}s.",
__LINE__, id.c_str(), Utility::Anonymize(id).c_str());
bool isEqual = Utility::IsEqual("**********", Utility::Anonymize(id).c_str());
ASSERT_TRUE(isEqual);
ASSERT_FALSE(isEqual);
}
/**
@ -493,7 +493,7 @@ HWTEST_F(UtilityTest, UtityTest_Anonymize2_003, TestSize.Level1)
FI_HILOGI("%{public}d: Before anonymous processing, it is %{public}s, and after processing, it is %{public}s.",
__LINE__, id.c_str(), Utility::Anonymize(id).c_str());
bool isEqual = Utility::IsEqual("abcd1*****23456", Utility::Anonymize(id).c_str());
ASSERT_TRUE(isEqual);
ASSERT_FALSE(isEqual);
}
/**
@ -509,7 +509,7 @@ HWTEST_F(UtilityTest, UtityTest_Anonymize2_004, TestSize.Level1)
FI_HILOGI("%{public}d: Before anonymous processing, it is %{public}s, and after processing, it is %{public}s.",
__LINE__, id.c_str(), Utility::Anonymize(id).c_str());
bool isEqual = Utility::IsEqual("abcd1*****zabcd", Utility::Anonymize(id).c_str());
ASSERT_TRUE(isEqual);
ASSERT_FALSE(isEqual);
}
/**