1/* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include <gtest/gtest.h> 17 18#include "proto.h" 19#include "util_ex.h" 20 21namespace OHOS { 22namespace MMI { 23namespace { 24using namespace testing::ext; 25using namespace OHOS; 26} // namespace 27class UtilExTest : public testing::Test { 28public: 29 static void SetUpTestCase(void) {} 30 static void TearDownTestCase(void) {} 31}; 32 33/** 34 * @tc.name:EnumAdd_001 35 * @tc.desc:Verify enum add 36 * @tc.type: FUNC 37 * @tc.require: 38 */ 39HWTEST_F(UtilExTest, EnumAdd_001, TestSize.Level1) 40{ 41 MmiMessageId messageId1 = MmiMessageId::INVALID; 42 auto messageId2 = EnumAdd(messageId1, 1); 43 EXPECT_EQ(messageId2, MmiMessageId::LIBINPUT_EVENT_DEVICE_ADDED); 44} 45 46/** 47 * @tc.name:EnumAdd_002 48 * @tc.desc:Verify enum add 49 * @tc.type: FUNC 50 * @tc.require: 51 */ 52HWTEST_F(UtilExTest, EnumAdd_002, TestSize.Level1) 53{ 54 MmiMessageId messageId1 = MmiMessageId::LIBINPUT_EVENT_DEVICE_ADDED; 55 auto messageId2 = EnumAdd(messageId1, -1); 56 EXPECT_EQ(messageId2, MmiMessageId::INVALID); 57} 58} // namespace MMI 59} // namespace OHOS