File: g02_05copy.t

package info (click to toggle)
libgraph-perl 1%3A0.96-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,316 kB
  • ctags: 938
  • sloc: perl: 6,094; sh: 8; makefile: 2
file content (51 lines) | stat: -rw-r--r-- 1,029 bytes parent folder | download | duplicates (6)
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
use Graph;

use strict;
local $^W = 1;

print "1..10\n";

my $g = new Graph(compat02 => 1);

$g->add_edge('a', 'b');
$g->add_edge('b', 'c');
$g->add_edge('a', 'd');
$g->add_vertex('e');

my $h = $g->copy;

print "not " unless $g->vertices == $h->vertices;
print "ok 1\n";

print "not " unless join(" ", sort $h->vertices) eq "a b c d e";
print "ok 2\n";

print "not " unless $g->edges == $h->edges;
print "ok 3\n";

print "not " unless join(" ", $h->edges) eq "a b a d b c";
print "ok 4\n";

$g->delete_vertex('e');

print "not " unless join(" ", $h->vertices) eq "a b c d e";
print "ok 5\n";

print "not " unless join(" ", $h->edges) eq "a b a d b c";
print "ok 6\n";

$g->delete_vertex('b');

print "not " unless join(" ", $h->vertices) eq "a b c d e";
print "ok 7\n";

print "not " unless join(" ", $h->edges) eq "a b a d b c";
print "ok 8\n";

$g->delete_edge('a', 'b');

print "not " unless join(" ", $h->vertices) eq "a b c d e";
print "ok 9\n";

print "not " unless join(" ", $h->edges) eq "a b a d b c";
print "ok 10\n";