From 4850e7e4ffed147a6f7ed1c3b7030d5009ae642e Mon Sep 17 00:00:00 2001 From: li-tiangang4 Date: Fri, 23 Feb 2024 12:29:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=8A=E8=AD=A6=EF=BC=9A?= =?UTF-8?q?=E6=97=A0=E7=AC=A6=E5=8F=B7=E6=95=B0=E4=B8=8E=E5=B0=8F=E4=BA=8E?= =?UTF-8?q?0=E4=BD=9C=E6=AF=94=E8=BE=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-tiangang4 --- utils/src/dinput_utils_tool.cpp | 4 ++-- utils/test/unittest/dinput_context_test.cpp | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/utils/src/dinput_utils_tool.cpp b/utils/src/dinput_utils_tool.cpp index 6bf0655..f7136a4 100644 --- a/utils/src/dinput_utils_tool.cpp +++ b/utils/src/dinput_utils_tool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-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. * You may obtain a copy of the License at @@ -450,7 +450,7 @@ int32_t GetRandomInt32() std::string JointDhIds(const std::vector &dhids) { - if (dhids.size() <= 0) { + if (dhids.size() == 0) { return ""; } auto dotFold = [](std::string a, std::string b) {return std::move(a) + DHID_SPLIT + std::move(b);}; diff --git a/utils/test/unittest/dinput_context_test.cpp b/utils/test/unittest/dinput_context_test.cpp index 7c541d6..7b3211d 100644 --- a/utils/test/unittest/dinput_context_test.cpp +++ b/utils/test/unittest/dinput_context_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-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. * You may obtain a copy of the License at @@ -239,6 +239,13 @@ HWTEST_F(DInputContextTest, GetNodeDesc_001, testing::ext::TestSize.Level1) EXPECT_EQ(0, ret.size()); } +HWTEST_F(DInputContextTest, JointDhIds_001, testing::ext::TestSize.Level1) +{ + std::vector dhids; + std::string ret = JointDhIds(dhids); + EXPECT_EQ("", ret); +} + } // namespace DistributedInput } // namespace DistributedHardware } // namespace OHOS -- Gitee