|
|
@ -18,6 +18,7 @@ std::vector<int> generate_random_numbers(int n, int min, int max)
|
|
|
|
|
|
|
|
|
|
|
|
TEST_CASE( "Simple test" ) {
|
|
|
|
TEST_CASE( "Simple test" ) {
|
|
|
|
std::vector<int> v = { 1, 2, 3, 1};
|
|
|
|
std::vector<int> v = { 1, 2, 3, 1};
|
|
|
|
|
|
|
|
REQUIRE( performance_measuring::count_on_the_way(v) == 2 );
|
|
|
|
REQUIRE( performance_measuring::min_element_and_count(v) == 2 );
|
|
|
|
REQUIRE( performance_measuring::min_element_and_count(v) == 2 );
|
|
|
|
REQUIRE( performance_measuring::sort_and_upper_bound(v) == 2 );
|
|
|
|
REQUIRE( performance_measuring::sort_and_upper_bound(v) == 2 );
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -27,6 +28,9 @@ TEST_CASE("Benchmarking") {
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<int> v = generate_random_numbers(10000, 0, 1000);
|
|
|
|
std::vector<int> v = generate_random_numbers(10000, 0, 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BENCHMARK("count_on_the_way 10k") {
|
|
|
|
|
|
|
|
return performance_measuring::count_on_the_way(v);
|
|
|
|
|
|
|
|
};
|
|
|
|
BENCHMARK("min_element_and_count 10k") {
|
|
|
|
BENCHMARK("min_element_and_count 10k") {
|
|
|
|
return performance_measuring::min_element_and_count(v);
|
|
|
|
return performance_measuring::min_element_and_count(v);
|
|
|
|
};
|
|
|
|
};
|
|
|
|