mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 05:15:39 +02:00
Added --skip-benchmarks command-line option. (#2408)
Closes #2392 Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
This commit is contained in:
@@ -152,3 +152,20 @@ TEST_CASE("Benchmark containers", "[!benchmark]") {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Skip benchmark macros", "[!benchmark]") {
|
||||
std::vector<int> v;
|
||||
BENCHMARK("fill vector") {
|
||||
v.emplace_back(1);
|
||||
v.emplace_back(2);
|
||||
v.emplace_back(3);
|
||||
};
|
||||
REQUIRE(v.size() == 0);
|
||||
|
||||
std::size_t counter{0};
|
||||
BENCHMARK_ADVANCED("construct vector")(Catch::Benchmark::Chronometer meter) {
|
||||
std::vector<Catch::Benchmark::storage_for<std::string>> storage(meter.runs());
|
||||
meter.measure([&](int i) { storage[i].construct("thing"); counter++; });
|
||||
};
|
||||
REQUIRE(counter == 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user