-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequirements.cpp
More file actions
44 lines (35 loc) · 1.31 KB
/
Copy pathRequirements.cpp
File metadata and controls
44 lines (35 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "BenchmarkSupport.hpp"
#include <requirements/core/CoreModule.hpp>
namespace pegium::bench {
namespace {
std::string make_source(std::size_t targetBytes) {
constexpr std::size_t kEnvironmentCount = 24;
std::string source;
source.reserve(targetBytes + 1024);
source += "contact: \"bench\"\n";
for (std::size_t index = 0; index < kEnvironmentCount; ++index) {
source += "environment Env" + std::to_string(index) + ": \"Environment " +
std::to_string(index) + "\"\n";
}
std::size_t requirementIndex = 0;
while (source.size() < targetBytes) {
source += "req REQ" + std::to_string(requirementIndex) +
" \"Requirement " + std::to_string(requirementIndex) +
"\" applicable for Env" +
std::to_string(requirementIndex % kEnvironmentCount) + ", Env" +
std::to_string((requirementIndex + 1) % kEnvironmentCount) + "\n";
++requirementIndex;
}
return source;
}
} // namespace
void register_requirements_benchmarks(BenchmarkRegistry ®istry) {
register_full_build_benchmark(
registry,
{.name = "requirements",
.languageId = "requirements-lang",
.extension = ".req",
.registerLanguages = requirements::registerRequirementsCoreServices,
.makeSource = make_source});
}
} // namespace pegium::bench