File: 03_triangle.t

package info (click to toggle)
libgraph-moreutils-perl 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 152 kB
  • sloc: perl: 385; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 339 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl

use strict;
use warnings;
use Graph::MoreUtils qw( line );
use Graph::Undirected;
use Test::More tests => 3;

my $g = Graph::Undirected->new;
$g->add_edges( [ 'A', 'B' ], [ 'B', 'C' ], [ 'A', 'C' ] );

my $l = line( $g );

is( $l->vertices, 3 );
is( $l->edges, 3 );
is( (grep { $l->degree( $_ ) == 2 } $l->vertices), 3 );