Compare commits
2 commits
902ecb9905
...
77fa527028
Author | SHA1 | Date | |
---|---|---|---|
77fa527028 | |||
e4d9074616 |
1 changed files with 11 additions and 11 deletions
22
test.cpp
22
test.cpp
|
@ -7,9 +7,9 @@
|
|||
|
||||
struct Circle
|
||||
{
|
||||
float X;
|
||||
float Y;
|
||||
float R;
|
||||
double X;
|
||||
double Y;
|
||||
double R;
|
||||
};
|
||||
|
||||
bool circle_circle_intersect(const Circle& a, const Circle& b)
|
||||
|
@ -33,8 +33,8 @@ std::mt19937 rng(dev());
|
|||
|
||||
Circle generate_random_circle()
|
||||
{
|
||||
static std::uniform_real_distribution pos_dist(-100.0f, 100.0f);
|
||||
static std::uniform_real_distribution r_dist(-10.0f, 10.0f);
|
||||
static std::uniform_real_distribution pos_dist(0.0f, 100.0f);
|
||||
static std::uniform_real_distribution r_dist(5.0f, 15.0f);
|
||||
|
||||
return Circle
|
||||
{
|
||||
|
@ -46,13 +46,13 @@ Circle generate_random_circle()
|
|||
|
||||
TEST_CASE("Oh Hi Mark", "[test]")
|
||||
{
|
||||
BENCHMARK_ADVANCED("Circle circle (sqrt) [10000]")(
|
||||
BENCHMARK_ADVANCED("Circle circle (sqrt) [1000]")(
|
||||
Catch::Benchmark::Chronometer meter)
|
||||
{
|
||||
std::vector<Circle> circles;
|
||||
circles.reserve(10000);
|
||||
circles.reserve(1000);
|
||||
|
||||
for(int i = 0; i < 10000; ++i)
|
||||
for(int i = 0; i < 1000; ++i)
|
||||
{
|
||||
circles.emplace_back(generate_random_circle());
|
||||
}
|
||||
|
@ -78,13 +78,13 @@ TEST_CASE("Oh Hi Mark", "[test]")
|
|||
});
|
||||
};
|
||||
|
||||
BENCHMARK_ADVANCED("Circle circle (no sqrt) [10000]")(
|
||||
BENCHMARK_ADVANCED("Circle circle (no sqrt) [1000]")(
|
||||
Catch::Benchmark::Chronometer meter)
|
||||
{
|
||||
std::vector<Circle> circles;
|
||||
circles.reserve(10000);
|
||||
circles.reserve(1000);
|
||||
|
||||
for(int i = 0; i < 10000; ++i)
|
||||
for(int i = 0; i < 1000; ++i)
|
||||
{
|
||||
circles.emplace_back(generate_random_circle());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue