• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 "distributed_sched_dumper_test.h"
17 #include "test_log.h"
18 
19 using namespace testing;
20 using namespace testing::ext;
21 
22 namespace OHOS {
23 namespace DistributedSchedule {
SetUpTestCase()24 void DistributedSchedDumperTest::SetUpTestCase()
25 {
26     DTEST_LOG << "DistributedSchedDumperTest::SetUpTestCase" << std::endl;
27 }
28 
TearDownTestCase()29 void DistributedSchedDumperTest::TearDownTestCase()
30 {
31     DTEST_LOG << "DistributedSchedDumperTest::TearDownTestCase" << std::endl;
32 }
33 
TearDown()34 void DistributedSchedDumperTest::TearDown()
35 {
36     DTEST_LOG << "DistributedSchedDumperTest::TearDown" << std::endl;
37 }
38 
SetUp()39 void DistributedSchedDumperTest::SetUp()
40 {
41     DTEST_LOG << "DistributedSchedDumperTest::SetUp" << std::endl;
42 }
43 
44 /**
45  * @tc.name: DumpDefault_001
46  * @tc.desc: dump default info
47  * @tc.type: FUNC
48  * @tc.require: I60TOK
49  */
50 HWTEST_F(DistributedSchedDumperTest, DumpDefault_001, TestSize.Level3)
51 {
52     DTEST_LOG << "DistributedSchedDumperTest DumpDefault_001 begin" << std::endl;
53     std::string result = "";
54     bool res = DistributedSchedDumper::DumpDefault(result);
55     EXPECT_EQ(res, true);
56     DTEST_LOG << "DistributedSchedDumperTest DumpDefault_001 end" << std::endl;
57 }
58 
59 /**
60  * @tc.name: Dump_001
61  * @tc.desc: dump info with null arg
62  * @tc.type: FUNC
63  * @tc.require: I60TOK
64  */
65 HWTEST_F(DistributedSchedDumperTest, Dump_001, TestSize.Level3)
66 {
67     DTEST_LOG << "DistributedSchedDumperTest Dump_001 begin" << std::endl;
68     const std::vector<std::string> args = {};
69     std::string result = "";
70     bool res = DistributedSchedDumper::Dump(args, result);
71     EXPECT_EQ(res, true);
72     DTEST_LOG << "DistributedSchedDumperTest Dump_001 end" << std::endl;
73 }
74 
75 /**
76  * @tc.name: Dump_002
77  * @tc.desc: dump info with a correct arg
78  * @tc.type: FUNC
79  * @tc.require: I60TOK
80  */
81 HWTEST_F(DistributedSchedDumperTest, Dump_002, TestSize.Level3)
82 {
83     DTEST_LOG << "DistributedSchedDumperTest Dump_002 begin" << std::endl;
84     const std::vector<std::string> args = {"-connect"};
85     std::string result = "";
86     bool res = DistributedSchedDumper::Dump(args, result);
87     EXPECT_EQ(res, true);
88     DTEST_LOG << "DistributedSchedDumperTest Dump_002 end" << std::endl;
89 }
90 
91 /**
92  * @tc.name: Dump_003
93  * @tc.desc: dump info with a invalid arg
94  * @tc.type: FUNC
95  * @tc.require: I60TOK
96  */
97 HWTEST_F(DistributedSchedDumperTest, Dump_003, TestSize.Level3)
98 {
99     DTEST_LOG << "DistributedSchedDumperTest Dump_003 begin" << std::endl;
100     const std::vector<std::string> args = {"-invalid"};
101     std::string result = "";
102     bool res = DistributedSchedDumper::Dump(args, result);
103     EXPECT_EQ(res, false);
104     DTEST_LOG << "DistributedSchedDumperTest Dump_003 end" << std::endl;
105 }
106 
107 /**
108  * @tc.name: Dump_004
109  * @tc.desc: dump info with two args
110  * @tc.type: FUNC
111  * @tc.require: I60TOK
112  */
113 HWTEST_F(DistributedSchedDumperTest, Dump_004, TestSize.Level3)
114 {
115     DTEST_LOG << "DistributedSchedDumperTest Dump_004 begin" << std::endl;
116     const std::vector<std::string> args = {"-invalid1", "-invalid2"};
117     std::string result = "";
118     bool res = DistributedSchedDumper::Dump(args, result);
119     EXPECT_EQ(res, false);
120     DTEST_LOG << "DistributedSchedDumperTest Dump_004 end" << std::endl;
121 }
122 }
123 }