Skip to content

Commit bd43676

Browse files
committed
custom bench test
1 parent 1542f22 commit bd43676

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

t/custom.t

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use Test2::V0;
2+
use Benchmark::DKbench;
3+
use Math::Trig qw/:great_circle :pi/;
4+
5+
sub great_circle {
6+
my $iter = shift || 1;
7+
my $dist = 0;
8+
$dist +=
9+
great_circle_distance(rand(pi), rand(2 * pi), rand(pi), rand(2 * pi)) -
10+
great_circle_bearing(rand(pi), rand(2 * pi), rand(pi), rand(2 * pi)) +
11+
great_circle_direction(rand(pi), rand(2 * pi), rand(pi), rand(2 * pi))
12+
for 1 .. $iter;
13+
return $dist;
14+
}
15+
16+
17+
my %stats = suite_run({
18+
threads => 1,
19+
include => 'Math::Trig',
20+
extra_bench => { 'Math::Trig' => ['3144042.81433949', 5.5, \&great_circle, 400000, 2000000]}
21+
}
22+
);
23+
24+
ok($stats{'Math::Trig'}->{scores} > 0, 'Custom bench scored') or diag(\%stats);
25+
26+
done_testing();

0 commit comments

Comments
 (0)