~ubuntu-branches/ubuntu/saucy/bioperl/saucy-proposed

« back to all changes in this revision

Viewing changes to t/Node.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*-Perl-*-
2
 
## Bioperl Test Harness Script for Modules
3
 
##
4
 
 
5
 
my $error;
6
 
use strict;
7
 
BEGIN { 
8
 
    # to handle systems with no installed Test module
9
 
    # we include the t dir (where a copy of Test.pm is located)
10
 
    # as a fallback
11
 
    $error = 0; 
12
 
    eval { require Test; };
13
 
    if( $@ ) {
14
 
        use lib 't';
15
 
    }
16
 
    use Test;
17
 
    plan tests => 21;
18
 
}
19
 
 
20
 
use Bio::Tree::Node;
21
 
use Bio::Tree::AlleleNode;
22
 
 
23
 
ok(1);
24
 
 
25
 
my $node1 = new Bio::Tree::Node();
26
 
my $node2 = new Bio::Tree::Node();
27
 
ok($node1->is_Leaf() );
28
 
ok($node1->ancestor, undef);
29
 
 
30
 
my $pnode = new Bio::Tree::Node();
31
 
$pnode->add_Descendent($node1);
32
 
ok($node1->ancestor, $pnode);
33
 
$pnode->add_Descendent($node2);
34
 
ok($node2->ancestor, $pnode);
35
 
 
36
 
ok(! $pnode->is_Leaf);
37
 
 
38
 
my $phylo_node = new Bio::Tree::Node(-bootstrap => 0.25,
39
 
                                     -id => 'ADH_BOV',
40
 
                                     -desc => 'Taxon 1');
41
 
$node1->add_Descendent($phylo_node);
42
 
ok(! $node1->is_Leaf);
43
 
ok($phylo_node->ancestor, $node1);
44
 
ok($phylo_node->id, 'ADH_BOV');
45
 
ok($phylo_node->bootstrap, 0.25);
46
 
ok($phylo_node->description, 'Taxon 1');
47
 
 
48
 
ok $phylo_node->ancestor($node2), $node2;
49
 
ok $node1->is_Leaf;
50
 
ok my @descs = $node2->each_Descendent, 1;
51
 
ok $descs[0], $phylo_node;
52
 
 
53
 
my $allele_node = new Bio::Tree::AlleleNode();
54
 
$allele_node->add_Genotype(new Bio::PopGen::Genotype(-marker_name => 'm1',
55
 
                                                     -alleles=>  [ 0 ]));
56
 
$allele_node->add_Genotype(new Bio::PopGen::Genotype(-marker_name => 'm3',
57
 
                                                     -alleles=>  [ 1,1 ]));
58
 
$allele_node->add_Genotype(new Bio::PopGen::Genotype(-marker_name => 'm4',
59
 
                                                     -alleles=>  [ 0,4 ]));
60
 
ok($allele_node);
61
 
my @mkrs = $allele_node->get_marker_names;
62
 
 
63
 
ok(@mkrs, 3);
64
 
my ($m3) = $allele_node->get_Genotypes(-marker => 'm3');
65
 
ok($m3->get_Alleles, 2);
66
 
my ($a1) = $allele_node->get_Genotypes(-marker => 'm1')->get_Alleles;
67
 
ok($a1, 0);
68
 
 
69
 
my ($a2,$a3) = $allele_node->get_Genotypes(-marker => 'm4')->get_Alleles;
70
 
ok($a2, 0);
71
 
ok($a3, 4);