File: RelationshipType.t

package info (click to toggle)
bioperl 1.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 20,336 kB
  • ctags: 8,476
  • sloc: perl: 119,890; xml: 6,001; lisp: 121; makefile: 57
file content (68 lines) | stat: -rw-r--r-- 2,185 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*-Perl-*-
## Bioperl Test Harness Script for Modules
## $Id: RelationshipType.t,v 1.3 2003/05/27 22:13:41 lapp Exp $

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.t'

use strict;
BEGIN {
    # to handle systems with no installed Test module
    # we include the t dir (where a copy of Test.pm is located)
    # as a fallback
    eval { require Test; };
    if( $@ ) {
        use lib 't';
    }
    use Test;
    plan tests => 21;
}

use Bio::Ontology::RelationshipType;
use Bio::Ontology::Ontology;

my $ont = Bio::Ontology::Ontology->new(-name => "relationship type");
  
my $IS_A     = Bio::Ontology::RelationshipType->get_instance("IS_A", $ont);
my $PART_OF  = Bio::Ontology::RelationshipType->get_instance("PART_OF", $ont);
my $CONTAINS = Bio::Ontology::RelationshipType->get_instance("CONTAINS", $ont);
my $FOUND_IN = Bio::Ontology::RelationshipType->get_instance("FOUND_IN", $ont);
my $IS_A2    = Bio::Ontology::RelationshipType->get_instance("IS_A", $ont);

ok( $IS_A->isa( "Bio::Ontology::RelationshipType" ) );
ok( $IS_A->isa( "Bio::Ontology::TermI" ) );


ok( ! $IS_A->equals( $PART_OF ) );
ok( $IS_A->equals( $IS_A2 ) );
ok( $PART_OF->equals( $PART_OF ) );


ok( $IS_A->identifier(), undef ); # don't make up identifiers
ok( $IS_A->name(), "IS_A" );
ok( $IS_A->definition(), "IS_A relationship predicate (type)" );
ok( $IS_A->ontology()->name(), "relationship type" );


ok( $PART_OF->identifier(), undef ); # don't make up identifiers
ok( $PART_OF->name(), "PART_OF" );
ok( $PART_OF->definition(), "PART_OF relationship predicate (type)" );
ok( $PART_OF->ontology()->name(), "relationship type" );


ok( $CONTAINS->identifier(), undef ); # don't make up identifiers
ok( $CONTAINS->name(), "CONTAINS" );
ok( $CONTAINS->definition(), "CONTAINS relationship predicate (type)" );
ok( $CONTAINS->ontology()->name(), "relationship type" );


ok( $FOUND_IN->identifier(), undef ); # don't make up identifiers
ok( $FOUND_IN->name(), "FOUND_IN" );
ok( $FOUND_IN->definition(), "FOUND_IN relationship predicate (type)" );
ok( $FOUND_IN->ontology()->name(), "relationship type" );