Algorithm-SkipList
view release on metacpan or search on metacpan
This file contains message digests of all files listed in MANIFEST,
signed via the Module::Signature module, version 0.44.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
% cpansign -v
It will check each file's integrity, as well as the signature's
validity. If "==> Signature verified OK! <==" is not displayed,
the distribution may already have been compromised, and you should
not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
t/02-merge_append.t view on Meta::CPAN
{
my $g = new Algorithm::SkipList( node_class => 'NumericNode' );
foreach (20..29) {
$g->insert( $_, 1+$g->size );
}
my $count = $g->size;
foreach my $key (20..29) {
ok( defined $g->find($key), "verify key in g" );
my $h = $g->copy( $key );
ok( defined $h, "verify h is defined" );
ok( $h->size == $count, "verify size of h" );
ok( ($h->least)[0] == $key );
ok( ($h->least)[1] == $g->find($key) );
if ($key <= 28) {
my $h = $g->copy( $key, undef, 28 );
ok( defined $h, "verify h is defined" );
ok( $h->size == ($count-1), "verify size of h" );
ok( ($h->least)[0] == $key );
ok( ($h->least)[1] == $g->find($key) );
}
$count--;
}
my $h = $g->copy(19);
ok(! defined $h);
t/04-greatest.t view on Meta::CPAN
my $List = new Algorithm::SkipList;
foreach ('A'..'D') {
$List->insert($_, 1+$List->size);
}
{
my $last;
while ($List->size) {
my($key, $value) = $List->greatest;
ok($value == $List->delete($key), "verify greatest via deletion");
if (defined $last) {
ok($last gt $key);
}
$last = $key;
}
}
( run in 0.309 second using v1.01-cache-2.11-cpan-5467b0d2c73 )