version increase for final release, improved warning
[bioperl-network.git] / t / Edge.t
blob73bdad76bb4a7410ec25c37f7e0a898cf46dfc2d
1 # This is -*-Perl-*- code#
2 # Bioperl Test Harness Script for Modules
3 # $Id: protgraph.t,v 1.1 2004/03/13 23:45:32 radams Exp
5 use vars qw($NUMTESTS $DEBUG $ERROR);
6 use strict;
7 $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
9 BEGIN {
10         # to handle systems with no installed Test module
11         # we include the t dir (where a copy of Test.pm is located)
12         # as a fallback
13         eval { require Test; };
14         $ERROR = 0;
15         if ( $@ ) {
16                 use lib 't';
17         }
18         use Test;
19         $NUMTESTS = 7;
20         plan tests => $NUMTESTS;
21         eval { require Graph; };
22         if ($@) {
23                 warn "Graph module needed for the bioperl-network package, skipping tests";
24                 $ERROR = 1;
25         }
28 END {
29         foreach ( $Test::ntest..$NUMTESTS) {
30                 skip("Missing dependencies. Skipping tests",1);
31         }
34 exit 0 if $ERROR ==  1;
36 require Bio::Network::ProteinNet;
37 require Bio::Network::Edge;
38 require Bio::Network::Node;
39 require Bio::Seq;
41 my $verbose = 0;
42 $verbose = 1 if $DEBUG;
44 ok 1;
46 my $seq1 = Bio::Seq->new(-seq => "aaaaaaa");
47 my $seq2 = Bio::Seq->new(-seq => "ttttttt");
48 my $seq3 = Bio::Seq->new(-seq => "ccccccc");
50 my $node1 = Bio::Network::Node->new(-protein => $seq1);
51 my $node2 = Bio::Network::Node->new(-protein => [($seq2,$seq3)]);
53 my $edge = Bio::Network::Edge->new(-nodes => [($node1,$node2)]);
54 ok 1;
55 my $count = $edge->nodes;
56 ok $count, 2;
58 my @nodes = $edge->nodes;
59 ok $#nodes, 1;
61 # suppose that it's possible to construct an Edge with 1 Node,
62 # interacting with itself
63 $edge = Bio::Network::Edge->new(-nodes => [($node1)]);
64 ok 1;
65 $count = $edge->nodes;
66 ok $count, 1;
68 @nodes = $edge->nodes;
69 ok scalar @nodes, 1;
71 __END__