mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Fix wrong namespacing of benchmarking constructor helpers
This commit is contained in:

committed by
Martin Hořeňovský

parent
ad3f50bbc1
commit
0fbf4f3e15
@@ -1,5 +1,6 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/benchmark/catch_benchmark.hpp>
|
||||
#include <catch2/benchmark/catch_constructor.hpp>
|
||||
#include <catch2/catch_generators_specific.hpp>
|
||||
|
||||
#include <map>
|
||||
@@ -127,4 +128,18 @@ TEST_CASE("Benchmark containers", "[!benchmark]") {
|
||||
REQUIRE(v[i] == generated);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("construct and destroy example") {
|
||||
BENCHMARK_ADVANCED("construct")(Catch::Benchmark::Chronometer meter) {
|
||||
std::vector<Catch::Benchmark::storage_for<std::string>> storage(meter.runs());
|
||||
meter.measure([&](int i) { storage[i].construct("thing"); });
|
||||
};
|
||||
|
||||
BENCHMARK_ADVANCED("destroy")(Catch::Benchmark::Chronometer meter) {
|
||||
std::vector<Catch::Benchmark::destructable_object<std::string>> storage(meter.runs());
|
||||
for(auto&& o : storage)
|
||||
o.construct("thing");
|
||||
meter.measure([&](int i) { storage[i].destruct(); });
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user