Test shortest path algorithm

This commit is contained in:
Alessandro Ranellucci 2012-12-04 23:52:53 +01:00
parent accc598eb5
commit 3a2ca92ec3

View File

@ -2,7 +2,7 @@ use Test::More;
use strict;
use warnings;
plan tests => 4;
plan tests => 5;
BEGIN {
use FindBin;
@ -41,4 +41,15 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
}
}
{
my $collection = Slic3r::Polyline::Collection->new(polylines => [
Slic3r::Polyline->new([0,15], [0,18], [0,20]),
Slic3r::Polyline->new([0,10], [0,8], [0,5]),
]);
is_deeply
[ map $_->[Y], map @$_, $collection->shortest_path(Slic3r::Point->new(0,30)) ],
[20, 18, 15, 10, 8, 5],
'shortest path';
}
__END__