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);
7 $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
10 # to handle systems with no installed Test module
11 # we include the t dir (where a copy of Test.pm is located)
13 eval { require Test; };
20 plan tests => $NUMTESTS;
21 eval { require Graph::Undirected; };
23 warn("Graph required by the bioperl-network package, skipping tests");
26 eval { require Digest::MD5; };
28 warn("Digest::MD5 required for these tests, skipping tests");
34 foreach ( $Test::ntest..$NUMTESTS) {
35 skip("Missing dependencies. Skipping tests",1);
38 exit 0 if $ERROR == 1;
41 # The purpose of these tests is to check to see if bugs have been
42 # fixed in Perl's Graph, particularly refvertexed bugs
44 my $g = Graph::Undirected->new(refvertexed => 1);
48 my $seq1 = Digest::MD5->new;
49 my $seq2 = Digest::MD5->new;
50 my $seq3 = Digest::MD5->new;
51 my $seq4 = Digest::MD5->new;
53 my $str = "ljfgouyouiyougs";
55 $g->add_vertices($seq1,$seq2,$seq3,$seq4);
56 $g->add_edges([$seq1,$seq2],[$seq3,$seq4],[$seq3,$seq2]);
58 my @vs = $g->vertices; # OK
61 my $c = $g->complete; # OK
65 my $comp = $g->complement; # OK
66 @vs = $comp->vertices;
69 @vs = $g->interior_vertices; # OK
72 my $apsp = $g->APSP_Floyd_Warshall;
73 @vs = $apsp->path_vertices($seq1,$seq4); # OK
76 my $seq = $g->random_vertex; # OK
79 my @rts = $g->articulation_points;
82 my $t = Graph::Traversal::DFS->new($g);
86 ok $seq->add($str); # NOT OK in version .73
89 @vs = $g->articulation_points;
90 ok $vs[0]->add($str); # OK in version .70
93 my @cc = $g->connected_components;
96 ok $seq->add($str); # OK in version .70
100 my @bs = $g->bridges;
101 ok $bs[0][0]->add($str); # NOT OK in version .73
103 my $cg = $g->connected_graph;
105 # ok $vs[0]->add($str); # is my usage correct?
107 my @spd = $g->SP_Dijkstra($seq1,$seq4); # OK in version .70
109 my @spbf = $g->SP_Bellman_Ford($seq1,$seq4); # OK in version .70