• 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 #ifndef TEST_WUKONG_STATISTICS_ABILITY_H
17 #define TEST_WUKONG_STATISTICS_ABILITY_H
18 #include <iomanip>
19 #include <string>
20 
21 #include "data_set.h"
22 #include "statistics.h"
23 #include "wukong_define.h"
24 
25 namespace OHOS {
26 namespace WuKong {
27 
28 namespace {
29 class AbilityStatisticsRecord {
30 public:
31     std::string bundleName_ = "";
32     uint32_t inputedAbilityCount_ = 0;
33     uint32_t abilitiesCount_ = 0;
34     std::vector<std::string> inputedAbilities_;
35 };
36 }  // namespace
37 
38 class StatisticsAbility : public Statistics {
39 public:
40     StatisticsAbility() = default;
41     ~StatisticsAbility() = default;
42     void StatisticsDetail(std::vector<std::map<std::string, std::string>> srcDatas,
43                           std::map<std::string, std::shared_ptr<Table>> &destTables);
44 
45 private:
46     void UpdateLine(std::shared_ptr<AbilityStatisticsRecord> abilityStatisticsRecordPtr,
47                     std::vector<std::string> &line);
48     void SrcDatasPretreatment(std::vector<std::map<std::string, std::string>> srcDatas);
49     std::map<std::string, std::shared_ptr<AbilityStatisticsRecord>> abilityStatisticsMsg_;
50     std::vector<std::string> bundles_;
51     std::vector<std::string> headers_ = {"bundleName", "inputedAbilityCount", "abilitiesCount", "coverage"};
52     std::vector<std::vector<std::string>> record_;
53 };
54 
55 }  // namespace WuKong
56 }  // namespace OHOS
57 #endif