perltidy; fixes per Peter Rice, re: duplicated accessions in the index and unmunged...
[bioperl-live.git] / t / Coordinate / CoordinateGraph.t
blobce044aa2bb8ce6c1160704f66f56fd3989e524ba
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN { 
7     use lib '.';
8         use Bio::Root::Test;
9         
10         test_begin(-tests => 7);
11     
12         use_ok('Bio::Coordinate::Graph');
15 ok my $graph = Bio::Coordinate::Graph->new();
17 # graph structure
18 my $dag = {
19            9  => [],
20            8  => [9],
21            7  => [],
22            6  => [7, 8],
23            5  => [],
24            4  => [5],
25            3  => [6],
26            2  => [3, 4, 6],
27            1  => [2]
28           };
30 ok $graph->hash_of_arrays($dag);
33 my $a = 1;
34 my $b = 6;
35 is my @a = $graph->shortest_path($a, $b), 3;
37 $a = 7;
38 $b = 8;
39 is @a = $graph->shortest_path($a, $b), 1;
41 $a = 8;
42 $b = 9;
43 is @a = $graph->shortest_path($a, $b), 2;
44 $b = 2;
45 is @a = $graph->shortest_path($a, $b), 3;