From 3a2ca92ec3a92fc73fe7c73d15e7d76e8a746ec3 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Dec 2012 23:52:53 +0100 Subject: [PATCH] Test shortest path algorithm --- t/fill.t | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/t/fill.t b/t/fill.t index 28d3b9cb7a..11ed91e5f7 100644 --- a/t/fill.t +++ b/t/fill.t @@ -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__