1f6603c60Sopenharmony_ci/*
2f6603c60Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
3f6603c60Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4f6603c60Sopenharmony_ci * you may not use this file except in compliance with the License.
5f6603c60Sopenharmony_ci * You may obtain a copy of the License at
6f6603c60Sopenharmony_ci *
7f6603c60Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8f6603c60Sopenharmony_ci *
9f6603c60Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10f6603c60Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11f6603c60Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12f6603c60Sopenharmony_ci * See the License for the specific language governing permissions and
13f6603c60Sopenharmony_ci * limitations under the License.
14f6603c60Sopenharmony_ci */
15f6603c60Sopenharmony_ci
16f6603c60Sopenharmony_ci
17f6603c60Sopenharmony_ci#include <stdio.h>
18f6603c60Sopenharmony_ci#include "gtest/gtest.h"
19f6603c60Sopenharmony_ci#include "log.h"
20f6603c60Sopenharmony_ci
21f6603c60Sopenharmony_ci#undef LOG_TAG
22f6603c60Sopenharmony_ci#undef LOG_DOMAIN
23f6603c60Sopenharmony_ci#define LOG_TAG "Test_TAG"
24f6603c60Sopenharmony_ci#define LOG_DOMAIN 0xD002D00
25f6603c60Sopenharmony_ci
26f6603c60Sopenharmony_ciusing namespace OHOS::HiviewDFX;
27f6603c60Sopenharmony_cistatic constexpr HiLogLabel LABEL = {LOG_CORE, 0xD002D00, "Test_TAG"};
28f6603c60Sopenharmony_ciusing namespace std;
29f6603c60Sopenharmony_ciusing namespace testing::ext;
30f6603c60Sopenharmony_ci
31f6603c60Sopenharmony_ciclass HiLogTest : public testing::Test {
32f6603c60Sopenharmony_ciprotected:
33f6603c60Sopenharmony_ci    static void SetUpTestCase(void) {}
34f6603c60Sopenharmony_ci    static void TearDownTestCase(void) {}
35f6603c60Sopenharmony_ci    virtual void SetUp() {}
36f6603c60Sopenharmony_ci    virtual void TearDown() {}
37f6603c60Sopenharmony_ci};
38f6603c60Sopenharmony_ci
39f6603c60Sopenharmony_ci/**
40f6603c60Sopenharmony_ci * @tc.number    : Sub_Dfx_Dft_HiLog_Cortexaapi_0100
41f6603c60Sopenharmony_ci * @tc.name      : HiLog_DEBUG parameter legal test (Cortex-A, C)
42f6603c60Sopenharmony_ci * @tc.desc      : [C- SOFTWARE -0200]
43f6603c60Sopenharmony_ci */
44f6603c60Sopenharmony_ciHWTEST_F(HiLogTest, subDfxDftHiLogCortexaapi0100, Function | MediumTest | Level0)
45f6603c60Sopenharmony_ci{
46f6603c60Sopenharmony_ci    HILOG_DEBUG(LOG_CORE, "Debug log of HiLog API test");
47f6603c60Sopenharmony_ci}
48f6603c60Sopenharmony_ci
49f6603c60Sopenharmony_ci
50f6603c60Sopenharmony_ci/**
51f6603c60Sopenharmony_ci * @tc.number    : Sub_Dfx_Dft_HiLog_Cortexaapi_0200
52f6603c60Sopenharmony_ci * @tc.name      : HILOG_INFO parameter legal test (Cortex-A, C)
53f6603c60Sopenharmony_ci * @tc.desc      : [C- SOFTWARE -0200]
54f6603c60Sopenharmony_ci */
55f6603c60Sopenharmony_ciHWTEST_F(HiLogTest, subDfxDftHiLogCortexaapi0200, Function | MediumTest | Level1)
56f6603c60Sopenharmony_ci{
57f6603c60Sopenharmony_ci    HILOG_INFO(LOG_CORE, "Info log of HiLog API test");
58f6603c60Sopenharmony_ci}
59f6603c60Sopenharmony_ci
60f6603c60Sopenharmony_ci/**
61f6603c60Sopenharmony_ci * @tc.number    : Sub_Dfx_Dft_HiLog_Cortexaapi_0300
62f6603c60Sopenharmony_ci * @tc.name      : HILOG_WARN parameter legal test (Cortex-A, C)
63f6603c60Sopenharmony_ci * @tc.desc      : [C- SOFTWARE -0200]
64f6603c60Sopenharmony_ci */
65f6603c60Sopenharmony_ciHWTEST_F(HiLogTest, subDfxDftHiLogCortexaapi0300, Function | MediumTest | Level1)
66f6603c60Sopenharmony_ci{
67f6603c60Sopenharmony_ci    HILOG_WARN(LOG_CORE, "Warn log of HiLog API test");
68f6603c60Sopenharmony_ci}
69f6603c60Sopenharmony_ci
70f6603c60Sopenharmony_ci/**
71f6603c60Sopenharmony_ci * @tc.number    : Sub_Dfx_Dft_HiLog_Cortexaapi_0400
72f6603c60Sopenharmony_ci * @tc.name      : HILOG_ERROR parameter legal test (Cortex-A, C)
73f6603c60Sopenharmony_ci * @tc.desc      : [C- SOFTWARE -0200]
74f6603c60Sopenharmony_ci */
75f6603c60Sopenharmony_ciHWTEST_F(HiLogTest, subDfxDftHiLogCortexaapi0400, Function | MediumTest | Level1)
76f6603c60Sopenharmony_ci{
77f6603c60Sopenharmony_ci    HILOG_ERROR(LOG_CORE, "Error log of HiLog API test");
78f6603c60Sopenharmony_ci}
79f6603c60Sopenharmony_ci
80f6603c60Sopenharmony_ci/**
81f6603c60Sopenharmony_ci * @tc.number    : Sub_Dfx_Dft_HiLog_Cortexaapi_0500
82f6603c60Sopenharmony_ci * @tc.name      : HILOG_FATAL parameter legal test (Cortex-A, C)
83f6603c60Sopenharmony_ci * @tc.desc      : [C- SOFTWARE -0200]
84f6603c60Sopenharmony_ci */
85f6603c60Sopenharmony_ciHWTEST_F(HiLogTest, subDfxDftHiLogCortexaapi0500, Function | MediumTest | Level1)
86f6603c60Sopenharmony_ci{
87f6603c60Sopenharmony_ci    HILOG_FATAL(LOG_CORE, "Fatal log of HiLog API test");
88f6603c60Sopenharmony_ci}
89f6603c60Sopenharmony_ci
90f6603c60Sopenharmony_ci/**
91f6603c60Sopenharmony_ci * @tc.number    : Sub_Dfx_Dft_HiLog_Cortexaapi_0600
92f6603c60Sopenharmony_ci * @tc.name      : HiLog::Debug parameter legal test (Cortex-A, C)
93f6603c60Sopenharmony_ci * @tc.desc      : [C- SOFTWARE -0200]
94f6603c60Sopenharmony_ci */
95f6603c60Sopenharmony_ciHWTEST_F(HiLogTest, subDfxDftHiLogCortexaapi0600, Function | MediumTest | Level1)
96f6603c60Sopenharmony_ci{
97f6603c60Sopenharmony_ci    bool ret = true;
98f6603c60Sopenharmony_ci    ret = HiLog::Debug(LABEL, "Debug log of HiLog API test");
99f6603c60Sopenharmony_ci    EXPECT_TRUE(ret);
100f6603c60Sopenharmony_ci}
101f6603c60Sopenharmony_ci
102f6603c60Sopenharmony_ci/**
103f6603c60Sopenharmony_ci * @tc.number    : Sub_Dfx_Dft_HiLog_Cortexaapi_0700
104f6603c60Sopenharmony_ci * @tc.name      : HiLog::Error parameter legal test (Cortex-A, C)
105f6603c60Sopenharmony_ci * @tc.desc      : [C- SOFTWARE -0200]
106f6603c60Sopenharmony_ci */
107f6603c60Sopenharmony_ciHWTEST_F(HiLogTest, subDfxDftHiLogCortexaapi0700, Function | MediumTest | Level1)
108f6603c60Sopenharmony_ci{
109f6603c60Sopenharmony_ci    bool ret = true;
110f6603c60Sopenharmony_ci    ret = HiLog::Error(LABEL, "Error log of HiLog API test");
111f6603c60Sopenharmony_ci    EXPECT_TRUE(ret);
112f6603c60Sopenharmony_ci}
113f6603c60Sopenharmony_ci
114f6603c60Sopenharmony_ci/**
115f6603c60Sopenharmony_ci * @tc.number    : Sub_Dfx_Dft_HiLog_Cortexaapi_0800
116f6603c60Sopenharmony_ci * @tc.name      : HiLog::Fatal parameter legal test (Cortex-A, C)
117f6603c60Sopenharmony_ci * @tc.desc      : [C- SOFTWARE -0200]
118f6603c60Sopenharmony_ci */
119f6603c60Sopenharmony_ciHWTEST_F(HiLogTest, subDfxDftHiLogCortexaapi0800, Function | MediumTest | Level1)
120f6603c60Sopenharmony_ci{
121f6603c60Sopenharmony_ci    bool ret = true;
122f6603c60Sopenharmony_ci    ret = HiLog::Fatal(LABEL, "Fatal log of HiLog API test");
123f6603c60Sopenharmony_ci    EXPECT_TRUE(ret);
124f6603c60Sopenharmony_ci}
125f6603c60Sopenharmony_ci
126f6603c60Sopenharmony_ci/**
127f6603c60Sopenharmony_ci * @tc.number    : Sub_Dfx_Dft_HiLog_Cortexaapi_0900
128f6603c60Sopenharmony_ci * @tc.name      : HiLog::Info parameter legal test (Cortex-A, C)
129f6603c60Sopenharmony_ci * @tc.desc      : [C- SOFTWARE -0200]
130f6603c60Sopenharmony_ci */
131f6603c60Sopenharmony_ciHWTEST_F(HiLogTest, subDfxDftHiLogCortexaapi0900, Function | MediumTest | Level1)
132f6603c60Sopenharmony_ci{
133f6603c60Sopenharmony_ci    bool ret = true;
134f6603c60Sopenharmony_ci    ret = HiLog::Info(LABEL, "Info log of HiLog API test");
135f6603c60Sopenharmony_ci    EXPECT_TRUE(ret);
136f6603c60Sopenharmony_ci}
137f6603c60Sopenharmony_ci
138f6603c60Sopenharmony_ci/**
139f6603c60Sopenharmony_ci * @tc.number    : Sub_Dfx_Dft_HiLog_Cortexaapi_1000
140f6603c60Sopenharmony_ci * @tc.name      : HiLog::Warn parameter legal test (Cortex-A, C)
141f6603c60Sopenharmony_ci * @tc.desc      : [C- SOFTWARE -0200]
142f6603c60Sopenharmony_ci */
143f6603c60Sopenharmony_ciHWTEST_F(HiLogTest, subDfxDftHiLogCortexaapi1000, Function | MediumTest | Level1)
144f6603c60Sopenharmony_ci{
145f6603c60Sopenharmony_ci    bool ret = true;
146f6603c60Sopenharmony_ci    ret = HiLog::Warn(LABEL, "Warn log of HiLog API test");
147f6603c60Sopenharmony_ci    EXPECT_TRUE(ret);
148f6603c60Sopenharmony_ci}
149