File: 16bench.t

package info (click to toggle)
libtest-modern-perl 0.013-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 272 kB
  • sloc: perl: 760; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
=pod

=encoding utf-8

=head1 PURPOSE

Test Test::Modern's C<is_fastest>.

=head1 AUTHOR

Toby Inkster E<lt>tobyink@cpan.orgE<gt>.

=head1 COPYRIGHT AND LICENCE

This software is copyright (c) 2014 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut

use Test::Modern -benchmark;
no warnings qw(recursion);

sub fib {
	my $n = shift;
	$n<2 ? $n : fib($n-1)+fib($n-2);
}

is_fastest('fib_3', -1, {
	fib_3    => q{ fib(3) },
	fib_13   => q{ fib(13) },
});

done_testing;