• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 21780928802

07 Feb 2026 01:36PM UTC coverage: 90.068% (+0.003%) from 90.065%
21780928802

Pull #5295

github

web-flow
Merge cbabeb61a into ebf8f0044
Pull Request #5295: Reduce header dependencies in tests and cli

102234 of 113508 relevant lines covered (90.07%)

11464546.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.24
/src/cli/perf.cpp
1
/*
2
* (C) 2024 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6

7
#include "perf.h"
8

9
#include "cli_exceptions.h"
10
#include <map>
11

12
namespace Botan_CLI {
13

14
PerfTest::Registration::Registration(const std::string& name, const PerfTest::pt_maker_fn& maker_fn) {
81,928✔
15
   std::map<std::string, PerfTest::pt_maker_fn>& reg = PerfTest::global_registry();
81,928✔
16

17
   if(reg.contains(name)) {
81,928✔
18
      throw CLI_Error("Duplicated registration of command " + name);
×
19
   }
20

21
   reg.insert(std::make_pair(name, maker_fn));
81,928✔
22
}
81,928✔
23

24
//static
25
std::map<std::string, PerfTest::pt_maker_fn>& PerfTest::global_registry() {
81,954✔
26
   static std::map<std::string, PerfTest::pt_maker_fn> g_perf_tests;
81,954✔
27
   return g_perf_tests;
81,954✔
28
}
29

30
//static
31
std::unique_ptr<PerfTest> PerfTest::get(const std::string& name) {
26✔
32
   const auto& reg = PerfTest::global_registry();
26✔
33

34
   auto i = reg.find(name);
26✔
35
   if(i != reg.end()) {
26✔
36
      return i->second();
18✔
37
   }
38

39
   return PerfTest::get_sym(name);
8✔
40
}
41

42
std::string PerfTest::format_name(const std::string& alg, const std::string& param) const {
36✔
43
   if(param.empty()) {
36✔
44
      return alg;
4✔
45
   }
46
   if(param.starts_with(alg)) {
32✔
47
      return param;
6✔
48
   }
49
   return alg + "+" + param;
52✔
50
}
51

52
}  // namespace Botan_CLI
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc