Initial commit with BinaryGap solution
This commit is contained in:
commit
8f07d88496
6 changed files with 150 additions and 0 deletions
30
t/01-binary_gap.t
Normal file
30
t/01-binary_gap.t
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
use Test2::V0;
|
||||
use Test2::Plugin::ExitSummary;
|
||||
|
||||
use FindBin qw($Bin);
|
||||
use lib "$Bin/../lib";
|
||||
use BinaryGap;
|
||||
|
||||
# plan(2);
|
||||
|
||||
my %test_data = (
|
||||
1 => '0',
|
||||
9 => '2',
|
||||
529 => '4',
|
||||
20 => '1',
|
||||
15 => '0',
|
||||
32 => '0',
|
||||
1041 => '5',
|
||||
6 => '0',
|
||||
328 => '2',
|
||||
51712 => '2',
|
||||
20 => '1',
|
||||
);
|
||||
|
||||
|
||||
plan(scalar(keys %test_data));
|
||||
|
||||
for my $key (keys %test_data) {
|
||||
my $binary_gap = BinaryGap::solution($key);
|
||||
is($binary_gap, $test_data{$key}, "Binary gap for $key is correct");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue