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 "pasteboard_time.h"
19
20 namespace OHOS::MiscServices {
21 using namespace testing::ext;
22
23 class PasteboardTimeTest : public testing::Test {
24 public:
25 static void SetUpTestCase(void);
26 static void TearDownTestCase(void);
27 void SetUp();
28 void TearDown();
29 };
30
SetUpTestCase(void)31 void PasteboardTimeTest::SetUpTestCase(void) { }
32
TearDownTestCase(void)33 void PasteboardTimeTest::TearDownTestCase(void) { }
34
SetUp(void)35 void PasteboardTimeTest::SetUp(void) { }
36
TearDown(void)37 void PasteboardTimeTest::TearDown(void) { }
38
39 /**
40 * @tc.name: GetCurrentTimeMicros
41 * @tc.desc: Get current time.
42 * @tc.type: FUNC
43 */
44 HWTEST_F(PasteboardTimeTest, GetCurrentTimeMicros, TestSize.Level0)
45 {
46 auto result = PasteBoardTime::GetCurrentTimeMicros();
47 EXPECT_TRUE(result > 0);
48 }
49
50 /**
51 * @tc.name: GetBootTimeMs
52 * @tc.desc: Get boot time.
53 * @tc.type: FUNC
54 */
55 HWTEST_F(PasteboardTimeTest, GetBootTimeMs, TestSize.Level0)
56 {
57 auto result = PasteBoardTime::GetBootTimeMs();
58 EXPECT_TRUE(result >= 0);
59 }
60
61 /**
62 * @tc.name: GetWallTimeMs
63 * @tc.desc: Get wall time.
64 * @tc.type: FUNC
65 */
66 HWTEST_F(PasteboardTimeTest, GetWallTimeMs, TestSize.Level0)
67 {
68 auto result = PasteBoardTime::GetWallTimeMs();
69 EXPECT_TRUE(result >= 0);
70 }
71 } // namespace OHOS::MiscServices
72