1 /*
2 * Copyright (c) 2021 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 #include "event_logger_config_test.h"
16
17 #include <iostream>
18 #include <memory>
19
20 #include "event_logger_config.h"
21 using namespace testing::ext;
22 using namespace OHOS::HiviewDFX;
23 namespace OHOS {
24 namespace HiviewDFX {
SetUp()25 void EventLoggerConfigTest::SetUp()
26 {
27 /**
28 * @tc.setup: create an event loop and multiple event handlers
29 */
30 printf("SetUp.\n");
31 }
32
TearDown()33 void EventLoggerConfigTest::TearDown()
34 {
35 /**
36 * @tc.teardown: destroy the event loop we have created
37 */
38 printf("TearDown.\n");
39 }
40
41 /**
42 * @tc.name: EventLoggerConfigTest002
43 * @tc.desc: parse a incorrect config file and check result
44 * @tc.type: FUNC
45 * @tc.require: AR000FT621
46 */
47 HWTEST_F(EventLoggerConfigTest, EventLoggerConfigTest002, TestSize.Level3)
48 {
49 /**
50 * @tc.steps: step1. create event handler and events
51 */
52 auto config = std::make_unique<EventLoggerConfig>("/data/test/test_data/event_logger_config");
53 EventLoggerConfig::EventLoggerConfigData configOut;
54 bool ret = config->FindConfigLine(0, "FWK_BLOCK", configOut);
55 EXPECT_EQ(configOut.action == "b,s=1,n=2,pb:0,aa:11,b:3", false);
56 printf("ret:%d\n", ret);
57 auto result = config->GetConfig();
58 auto config1 = std::make_unique<EventLoggerConfig>();
59 }
60 } // namespace HiviewDFX
61 } // namespace OHOS
62