File: u_bo1.t

package info (click to toggle)
libgraph-perl 1%3A0.91-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 1,152 kB
  • ctags: 590
  • sloc: perl: 6,065; makefile: 37; sh: 8
file content (80 lines) | stat: -rw-r--r-- 1,652 bytes parent folder | download | duplicates (3)
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
69
70
71
72
73
74
75
76
77
78
79
80
use Test::More tests => 20;

require Graph::Undirected;
require Graph::Traversal::DFS;

use lib "t";
require "simple.pl";

#
# The purpose of these tests is to check to see if particular 
# bugs have been fixed in Perl's Graph
#
my $g = Graph::Undirected->new(refvertexed => 1);

ok 1;

my $seq1 = Foo->new;
my $seq2 = Foo->new;
my $seq3 = Foo->new;
my $seq4 = Foo->new;

my $str = "ljfgouyouiyougs";

$g->add_vertices($seq1,$seq2,$seq3,$seq4);
$g->add_edges([$seq1,$seq2],[$seq3,$seq4],[$seq3,$seq2]);

my @vs = $g->vertices; # OK
ok $vs[0]->xyz($str);

my $c = $g->complete; # OK
@vs = $c->vertices;
ok $vs[0]->xyz($str);

my $comp = $g->complement; # OK
@vs = $comp->vertices;
ok $vs[0]->xyz($str);

@vs = $g->interior_vertices; # OK
ok $vs[0]->xyz($str);

my $apsp = $g->APSP_Floyd_Warshall;
@vs = $apsp->path_vertices($seq1,$seq4); # OK
ok $vs[0]->xyz($str);

my $seq = $g->random_vertex; # OK
ok $seq->xyz($str);

my @rts = $g->articulation_points;
ok @rts;

my $t = Graph::Traversal::DFS->new($g);
$t->dfs;
@vs = $t->seen;
for my $seq (@vs) {
	ok $seq->xyz($str); # NOT OK in version .73
}

@vs = $g->articulation_points; 
ok $vs[0]->xyz($str); # OK in version .70
is scalar @vs, 2;

my @cc = $g->connected_components;
for my $ref (@cc) {
	for my $seq (@$ref) {
		ok $seq->xyz($str); # OK in version .70
	}
}

my @bs = $g->bridges;
ok $bs[0][0]->xyz($str); # NOT OK in version .73

my $cg = $g->connected_graph(super_component => sub { $_[0] });
@vs = $cg->vertices;
ok $vs[0]->xyz($str); # OK in version .73

my @spd = $g->SP_Dijkstra($seq1,$seq4); # OK in version .70

my @spbf = $g->SP_Bellman_Ford($seq1,$seq4); # OK in version .70

__END__