File: path.t

package info (click to toggle)
libgraph-easy-perl 0.71-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,284 kB
  • sloc: perl: 24,909; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 750 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl -w

use Test::More;
use strict;

BEGIN
   {
   plan tests => 7;
   chdir 't' if -d 't';
   use lib '../lib';
   use_ok ("Graph::Easy::Layout") or die($@);
   use_ok ("Graph::Easy") or die($@);
   };

can_ok ("Graph::Easy", qw/
  _path_is_clear
  /);

my $path = [
  0,0,0,
  1,0,0,
  2,0,0,
  2,1,0,
  2,2,0,
  2,3,0,
  2,4,0,
  ];

my $cells = {};

#############################################################################
# path tests

my $graph = Graph::Easy->new();
is (ref($graph), 'Graph::Easy');
is ($graph->error(), '', 'no error yet');

$graph->{cells} = $cells;

is ($graph->_path_is_clear( $path, $cells), 1, 'path is clear');

$cells->{"2,2"} = 1;

is ($graph->_path_is_clear( $path, $cells), 0, 'path is blocked');