X-Git-Url: http://git.shiar.net/perl/list-index.git/blobdiff_plain/1c331324738bb8ca05889f1a7baa5e1b40595d38..3e2d0470d99683367de89a9ad4569247d3897355:/t/10-ranges.t diff --git a/t/10-ranges.t b/t/10-ranges.t index ef292b1..f935820 100644 --- a/t/10-ranges.t +++ b/t/10-ranges.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 6; +use Test::More tests => 7; use Test::NoWarnings; use Data::Dump 'pp'; @@ -53,3 +53,27 @@ subtest 'context' => sub { #pp($index->ranges({pagesize => 2, context => 2, length => 1})); }; +subtest 'distribution' => sub { + plan tests => 2; + my $index = List::Index->new([qw( + kkeg kl km kmlu knsy koxb kpeo kuaa kuab kuac + kuap kuaq kuq kux kzb lc lg lgu lgua lguc + lguq lgur lgus lgx lka lkq lks lln llq llx + )]) or return; +TODO: { + local $TODO = 'under development'; + is_deeply( + $index->ranges({ pagesize=>10, context=>3 }), + # shorten 'kuap' to 'ku' because lookbehind is 'kp...' + # 'lguq' matches 'lg', but may only backtrack to 'lgu' + [qw(-kt ku-lgt lgu-)], + 'lookbehind' + ); +} + is_deeply( + $index->ranges({ pagesize=>10, context=>4 }), + [qw(-kt ku-lf lg-)], + 'maximal lookahead' + ); +} +