GenOO
view release on metacpan or search on metacpan
t/lib_for_test_class/Test/GenOO/Data/Structure/DoubleHashArray.pm view on Meta::CPAN
can_ok $self->obj, 'entries_count';
is $self->obj->entries_count, 12, "... and should return the correct value";
}
sub foreach_entry_do : Test(3) {
my ($self) = @_;
can_ok $self->obj, 'foreach_entry_do';
my $iterations = 0;
$self->obj->foreach_entry_do(sub{
my ($arg) = @_;
$iterations++ if ($arg =~ /^\d+$/);
});
is $iterations, $self->obj->entries_count, "... and should do the correct number of iterations";
$iterations = 0;
$self->obj->foreach_entry_do(sub{
my ($arg) = @_;
$iterations++ if ($arg =~ /^\d+$/);
return 'break_loop' if ($iterations == 3)
});
is $iterations, 3, "... and should break when requested";
}
sub foreach_entry_on_secondary_key_do : Test(2) {
my ($self) = @_;
can_ok $self->obj, 'foreach_entry_on_secondary_key_do';
my $iterations = 0;
$self->obj->foreach_entry_on_secondary_key_do('chr3', sub{
my ($arg) = @_;
if ($arg =~ /^\d+$/) {
$iterations++;
}
});
is $iterations, 3, "... and should do the correct number of iterations";
}
sub add_entry : Test(2) {
my ($self) = @_;
can_ok $self->obj, 'add_entry';
$self->obj->add_entry(-1, 'chr7', 41);
is $self->obj->entries_count, 13, "... and should result in the correct number of entries";
}
t/lib_for_test_class/Test/GenOO/RegionCollection/Type/DoubleHashArray.pm view on Meta::CPAN
isa_ok $self->obj(0)->all_records, 'ARRAY', "... and in scalar context returned object ";
is @{$self->obj(0)->all_records}, 12, "... with the correct number of records";
}
sub foreach_record_do : Test(2) {
my ($self) = @_;
can_ok $self->obj(0), 'foreach_record_do';
my $iterations = 0;
$self->obj(0)->foreach_record_do(
sub {
$iterations++;
}
);
is $iterations, $self->obj(0)->records_count, "... and should do the correct number of iterations";
}
sub foreach_record_on_rname_do : Test(2) {
my ($self) = @_;
can_ok $self->obj(0), 'foreach_record_on_rname_do';
my $iterations = 0;
$self->obj(0)->foreach_record_on_rname_do('chr1', sub {
$iterations++;
});
is $iterations, 3, "... and should do the correct number of iterations";
}
sub records_count : Test(2) {
my ($self) = @_;
can_ok $self->obj(0), 'records_count';
is $self->obj(0)->records_count, 12, "... and should result in the correct number of records";
}
sub strands : Test(2) {
( run in 1.410 second using v1.01-cache-2.11-cpan-71847e10f99 )