[BUG] bug 2598
[bioperl-live.git] / t / Relationship.t
blob08d891abe0c2d467dd98746c82352798e92b161a
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN {
7         use lib 't/lib';
8     use BioperlTest;
9     
10     test_begin(-tests => 12,
11                -requires_module => 'Graph::Directed');
12         
13     use_ok('Bio::Ontology::Relationship');
14     use_ok('Bio::Ontology::GOterm');
15     use_ok('Bio::Ontology::RelationshipType');
18 my $IS_A = Bio::Ontology::RelationshipType->get_instance( "IS_A" );
19 isa_ok($IS_A, "Bio::Ontology::RelationshipType");
21 my $parent = Bio::Ontology::GOterm->new();
22 isa_ok($parent, "Bio::Ontology::GOterm" );
24 my $child = Bio::Ontology::GOterm->new();
25 isa_ok($child, "Bio::Ontology::GOterm");
27 $parent->name( "parent" );
29 $child->name( "child" );
31 my $rel = Bio::Ontology::Relationship->new( -identifier        => "16847",
32                                             -parent_term       => $parent,
33                                             -child_term        => $child,
34                                             -relationship_type => $IS_A );
36 isa_ok($rel, "Bio::Ontology::Relationship");
38 is( $rel->identifier(), "16847" );
40 is( $rel->parent_term()->name(), "parent" );
42 is( $rel->child_term()->name(), "child" );
44 is( $rel->relationship_type()->name(), "IS_A" );
46 ok( $rel->to_string() );