File: 24_mixvertexed.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 (48 lines) | stat: -rw-r--r-- 1,196 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
use Test::More tests => 128;
	
use Graph;

for my $m (0, 1) {
    for my $r (0, 1) {
	for my $h (0, 1) {
	    my $g = Graph->new(countvertexed => $m,
			       refvertexed   => $r,
			       hypervertexed => $h);
	    print "# m = $m, c = $r, h = $h\n";
	    $g->add_vertex("a");
	    $g->add_vertex("a");
	    $g->add_vertex(my $b = []);
	    $g->add_vertex($b);
	    if ($g->hypervertexed) {
		$g->add_vertex("c", "d");
		$g->add_vertex("c", "d");
	    }
	    for (1, 2) {
		ok(  $g->has_vertices( ) );
		ok(  $g->has_vertex("a") );
		ok(  $g->has_vertex($b ) );
		if ($g->hypervertexed) {
		    ok(  $g->has_vertex("c", "d") );
		}
		ok( !$g->has_vertex("e") );
	    }
	    for (1, 2) {
		is( $g->get_vertex_count("a"),      $m ? 2 : 1 );
		is( $g->get_vertex_count($b ),      $m ? 2 : 1 );
		if ($g->hypervertexed) {
		    is( $g->get_vertex_count("c", "d"), $m ? 2 : 1 );
		}
		is( $g->get_vertex_count("e"),      0 );
	    }
	    if (0) {
		is( $g->get_vertex_value("a"), "a" );
		is_deeply( $g->get_vertex_value($b), $b );
		if ($g->hypervertexed) {
		    is_deeply( $g->get_vertex_value("c", "d"), $h ? "d" : "c" ); # @todo
		}
		is( $g->get_vertex_value("e"), undef);
	    }
	}
    }
}