[Iamb-dev] CVS: iamb-dev/pm/t stree.t,NONE,1.1
Status: Beta
Brought to you by:
rbowen
From: Matt C. <su...@us...> - 2001-02-07 03:51:11
|
Update of /cvsroot/iamb/iamb-dev/pm/t In directory usw-pr-cvs1:/tmp/cvs-serv21925/t Added Files: stree.t Log Message: stree stuff added. the test script is not proper yet (see perldoc Test) but i dont feel like correcting it right now. --- NEW FILE --- #!/usr/bin/perl BEGIN { $| = 1; print "1..5\n"; } END {print "not ok 1\n" unless $loaded;} use IAMB::Stree; $loaded = 1; print "ok 1\n"; my $obj = IAMB::Stree->new(STREE => '[1[2[3,4[5]]6[7,8,9]10,11[12,13[14[15[16]]17]]]'); #hackish i know but you shouldnt be calling this outside the module anyway my @test_explode = IAMB::Stree::_explode(STREE => $obj->stree); my $count = scalar @test_explode; if( $count == 34) { print "ok 2\n"; } else { print "not ok 2 \n"; } my ($before, $after) = $obj->dissect(ARTICLE => 9); if( ($before eq '[1[2[3,4[5]]6[7,8,') && ($after eq ']10,11[12,13[14[15[16]]17]]]')) { print "ok 3\n"; } else { print "not ok 3\n"; } my @ancestors = $obj->heritage( ARTICLE => 6); if ($ancestors[0] == 1) { print "ok 4\n"; } else { print "not ok 4\n"; } my $branch = $obj->prune( ARTICLE => 9 ); if($branch eq '[9]') { print "ok 5\n"; } else { print "not ok 5\n"; } |