tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / t / Tree / PhyloNetwork / TreeFactory.t
blobf7b65e3da27c1b36424ce444d554060736c65dae
1 # $Id$
2 # -*-Perl-*-
3 use strict;
5 BEGIN {
6   use lib '.';
7   use Bio::Root::Test;
9   test_begin(-tests => 19,
10              -requires_modules => [qw(Bio::PhyloNetwork)]);
12   use_ok('Bio::PhyloNetwork::TreeFactory');
15 my $factory=Bio::PhyloNetwork::TreeFactory->new(-numleaves=>4);
16 isa_ok($factory,'Bio::PhyloNetwork::TreeFactory');
18 my @nets;
20 while (my $net=$factory->next_network()) {
21   push @nets,$net;
24 is(scalar @nets,15,'tree factory');
26 my @netsbk;
28 foreach my $enw (<DATA>) {
29   my $net=Bio::PhyloNetwork->new(-eNewick=>$enw);
30   push @netsbk,$net;
32 is(scalar @netsbk,15,'seen all the data lines');
34 foreach my $net (@nets) {
35   my $found=0;
36   foreach my $netbk (@netsbk) {
37     if ($net->mu_distance($netbk)==0) {
38       $found=1;
39       last;
40     }
41   }
42   ok($found,'found');
45 __DATA__
46 (l2,((l1,l4),l3)); 
47 ((l1,l3),(l2,l4)); 
48 ((l1,(l3,l4)),l2); 
49 (l4,(l2,(l1,l3))); 
50 ((l4,(l3,l1)),l2); 
51 ((l2,l3),(l1,l4)); 
52 (l1,((l2,l4),l3)); 
53 (l1,((l3,l4),l2)); 
54 (l4,(l1,(l2,l3))); 
55 (l1,((l3,l2),l4)); 
56 (l3,((l1,l4),l2)); 
57 ((l1,(l2,l4)),l3); 
58 ((l1,l2),(l3,l4)); 
59 ((l4,(l2,l1)),l3); 
60 (l4,(l3,(l1,l2)));