r23964 - in /branches/upstream/libtree-redblack-perl/current: Changes MANIFEST META.yml README RedBlack.pm t/ t/redblack.t
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Fri Aug 8 18:57:54 UTC 2008
Author: dmn
Date: Fri Aug 8 18:57:52 2008
New Revision: 23964
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=23964
Log:
[svn-upgrade] Integrating new upstream version, libtree-redblack-perl (0.5)
Added:
branches/upstream/libtree-redblack-perl/current/META.yml
branches/upstream/libtree-redblack-perl/current/t/
branches/upstream/libtree-redblack-perl/current/t/redblack.t
Modified:
branches/upstream/libtree-redblack-perl/current/Changes
branches/upstream/libtree-redblack-perl/current/MANIFEST
branches/upstream/libtree-redblack-perl/current/README
branches/upstream/libtree-redblack-perl/current/RedBlack.pm
Modified: branches/upstream/libtree-redblack-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtree-redblack-perl/current/Changes?rev=23964&op=diff
==============================================================================
--- branches/upstream/libtree-redblack-perl/current/Changes (original)
+++ branches/upstream/libtree-redblack-perl/current/Changes Fri Aug 8 18:57:52 2008
@@ -11,3 +11,10 @@
0.3 Tue Jun 29 10:53:00 1999
- fixed memory leak; bholzman
+
+0.4 Thu Jul 31 10:33:00 2008
+ - fixed misspelled method name (value instead of val), ID 13482
+ - fix bug when using custom comparator, ID 19431
+
+0.5 Thu Jul 31 14:48:00 2008
+ - added some tests (still more to add)
Modified: branches/upstream/libtree-redblack-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtree-redblack-perl/current/MANIFEST?rev=23964&op=diff
==============================================================================
--- branches/upstream/libtree-redblack-perl/current/MANIFEST (original)
+++ branches/upstream/libtree-redblack-perl/current/MANIFEST Fri Aug 8 18:57:52 2008
@@ -4,3 +4,5 @@
Makefile.PL
RedBlack.pm
Node.pm
+t/redblack.t
+META.yml Module meta-data (added by MakeMaker)
Added: branches/upstream/libtree-redblack-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtree-redblack-perl/current/META.yml?rev=23964&op=file
==============================================================================
--- branches/upstream/libtree-redblack-perl/current/META.yml (added)
+++ branches/upstream/libtree-redblack-perl/current/META.yml Fri Aug 8 18:57:52 2008
@@ -1,0 +1,10 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Tree-RedBlack
+version: 0.5
+version_from: RedBlack.pm
+installdirs: site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30
Modified: branches/upstream/libtree-redblack-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtree-redblack-perl/current/README?rev=23964&op=diff
==============================================================================
--- branches/upstream/libtree-redblack-perl/current/README (original)
+++ branches/upstream/libtree-redblack-perl/current/README Fri Aug 8 18:57:52 2008
@@ -1,4 +1,4 @@
-Tree::RedBlack version 0.3
+Tree::RedBlack version 0.4
------------------------------------------------------------------------
This program is free software; you can redistribute it and/or modify
it under the terms of the Artistic License, a copy of which can be
@@ -36,21 +36,6 @@
(sorry, no test suite yet)
-Changes
--------
-Version 0.3
- Fixed memory leak since nodes pointed to their parents. Now,
- DESTROY does a tree-traversal. Still haven't fixed delete.
- I don't think the interface is going to change, so I've upgraded this
- module to beta status.
-
-Version 0.2
- Major mess-up in Makefile.PL made it un-installable.
- Changed how delete works a touch, but it hasn't been fixed yet
-
-Version 0.1
- First public alpha release
-
Feedback
--------
Modified: branches/upstream/libtree-redblack-perl/current/RedBlack.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtree-redblack-perl/current/RedBlack.pm?rev=23964&op=diff
==============================================================================
--- branches/upstream/libtree-redblack-perl/current/RedBlack.pm (original)
+++ branches/upstream/libtree-redblack-perl/current/RedBlack.pm Fri Aug 8 18:57:52 2008
@@ -3,7 +3,7 @@
use strict;
use Tree::RedBlack::Node;
use vars qw($VERSION);
-$VERSION = '0.3';
+$VERSION = '0.5';
=head1 NAME
@@ -137,7 +137,7 @@
return $val;
}
$node = $parent->new($key, $value);
- if ($this->{'cmp'} ? $this->{'cmp'}->($key, $node->key) < 0
+ if ($this->{'cmp'} ? $this->{'cmp'}->($key, $parent->key) < 0
: $key lt $parent->key) {
$parent->left($node);
} else {
@@ -148,7 +148,7 @@
}
$node->color(1);
while ($node != $this->{'root'} && $node->parent->color) {
- if ($node->parent == $node->parent->parent->left) {
+ if (defined $node->parent->parent->left && $node->parent == $node->parent->parent->left) {
my $uncle = $node->parent->parent->right;
if ($uncle && $uncle->color) {
$node->parent->color(0);
@@ -172,7 +172,7 @@
$node->parent->parent->color(1);
$node = $node->parent->parent;
} else {
- if ($node == $node->parent->left) {
+ if (defined $node->parent->left && $node == $node->parent->left) {
$node = $node->parent;
$this->right_rotate($node);
}
@@ -257,7 +257,7 @@
}
if ($successor != $node) {
$node->key($successor->key);
- $node->value($successor->value);
+ $node->val($successor->val);
}
if (!$successor->color) {
$this->delete_fixup($successor_child);
Added: branches/upstream/libtree-redblack-perl/current/t/redblack.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtree-redblack-perl/current/t/redblack.t?rev=23964&op=file
==============================================================================
--- branches/upstream/libtree-redblack-perl/current/t/redblack.t (added)
+++ branches/upstream/libtree-redblack-perl/current/t/redblack.t Fri Aug 8 18:57:52 2008
@@ -1,0 +1,64 @@
+use strict;
+
+use Test::More tests => 23;
+use Tree::RedBlack;
+
+my $tree = Tree::RedBlack->new();
+isa_ok($tree, 'Tree::RedBlack');
+
+is($tree->root, undef);
+
+is($tree->find(42), undef);
+is($tree->max, undef);
+is($tree->min, undef);
+
+$tree->insert(3, 'cat');
+is($tree->find(3), 'cat');
+
+is($tree->min->val, 'cat');
+
+is($tree->max->val, 'cat');
+
+is($tree->find(42), undef);
+
+$tree->insert(3, 'dog');
+is($tree->find(3), 'dog');
+
+$tree->insert(4);
+
+is($tree->max->val, undef);
+is($tree->find(4), undef);
+isa_ok($tree->node(4), 'Tree::RedBlack::Node');
+
+$tree->insert(7, 'dude');
+
+$tree->insert(5, 'really');
+
+$tree->insert(6, 'cool');
+
+is($tree->min->val, 'dog');
+is($tree->max->val, 'dude');
+
+is($tree->find(5), 'really');
+
+$tree->delete(3);
+is($tree->min->val, undef);
+
+is($tree->node(14), undef);
+
+
+my $tree2 = Tree::RedBlack->new();
+$tree2->cmp(sub { $_[0] <=> $_[1] });
+$tree2->insert(10);
+$tree2->insert(2);
+is($tree2->max->key, 10);
+is($tree2->min->key, 2);
+
+is($tree2->node(10), $tree2->max);
+is($tree2->node(2), $tree2->min);
+
+SKIP: {
+ skip 'delete not working correctly' => 1;
+ $tree2->delete(10);
+ is($tree2->max->key, 2);
+};
More information about the Pkg-perl-cvs-commits
mailing list