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

randombit / botan / 21789150028

08 Feb 2026 12:09AM UTC coverage: 90.068% (-0.005%) from 90.073%
21789150028

push

github

web-flow
Merge pull request #5295 from randombit/jack/header-patrol-3

Reduce header dependencies in tests and cli

102234 of 113507 relevant lines covered (90.07%)

11572088.66 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 TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc