Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tom Feist
committed
Sep 23, 2010
1 parent
21912ea
commit ed41bf0
Showing
2 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More; | ||
use Test::Exception; | ||
|
||
use Data::Dumper; | ||
use Devel::Peek qw/Dump DumpArray/; | ||
use Devel::FindRef; | ||
|
||
BEGIN { | ||
use_ok 'CProps::Trie'; | ||
} | ||
|
||
|
||
my $trie = new_ok 'CProps::Trie'; | ||
|
||
my @foo = qw/a b abc q efd abdce eeee x xxx xxxxy/; | ||
|
||
for (@foo) { | ||
ok($trie->add($_, $_)); | ||
} | ||
|
||
my @children = $trie->children('a'); | ||
is_deeply(\@children, [qw/a abc abdce/]); | ||
|
||
my @c2 = $trie->children('xx'); | ||
is_deeply(\@c2, [qw/xxx xxxxy/]); | ||
|
||
|
||
# TODO: why doesn't specifying the root (as '') work? | ||
my @c3 = $trie->children(undef); | ||
diag(Dumper(\@c3)); | ||
|
||
|
||
done_testing; |