1 /*
2 * Copyright (c) 2025 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 "eventcenter/event.h"
19
20 namespace OHOS::MiscServices {
21 using namespace testing::ext;
22 class EventTest : public testing::Test {
23 public:
24 static void SetUpTestCase(void);
25 static void TearDownTestCase(void);
26 void SetUp();
27 void TearDown();
28 };
29
SetUpTestCase(void)30 void EventTest::SetUpTestCase(void) {}
31
TearDownTestCase(void)32 void EventTest::TearDownTestCase(void) {}
33
SetUp(void)34 void EventTest::SetUp(void) {}
35
TearDown(void)36 void EventTest::TearDown(void) {}
37
38 /**
39 * @tc.name: GetEventIdTest
40 * @tc.desc: Test GetEventId
41 * @tc.type: FUNC
42 * @tc.require:
43 */
44 HWTEST_F(EventTest, GetEventIdTest, TestSize.Level0)
45 {
46 int32_t TestEventId = 123;
47 Event event(TestEventId);
48
49 int32_t result = event.GetEventId();
50
51 EXPECT_EQ(result, TestEventId);
52 }
53
54 /**
55 * @tc.name: EqualsTest
56 * @tc.desc: Test Equals
57 * @tc.type: FUNC
58 * @tc.require:
59 */
60 HWTEST_F(EventTest, EqualsTest, TestSize.Level0)
61 {
62 int32_t TestEventId = 123;
63 Event event1(TestEventId);
64 Event event2(TestEventId);
65
66 bool result = event1.Equals(event2);
67
68 EXPECT_EQ(result, false);
69 }
70 } // namespace OHOS::MiscServices
71