test ranges distribution
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 13 Nov 2009 15:00:17 +0000 (16:00 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 13 Nov 2009 15:00:17 +0000 (16:00 +0100)
t/10-ranges.t

index ef292b1f55ab67a4b110d19ffde6462093d0bc98..55df649fd835118519560f6bd7e69eb7332862ca 100644 (file)
@@ -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 kqbt krzu ktyp
+               kuap kuy kvbc kyy kzb  lc lg lgaa lgbv lgbw
+               lgu lij ljr ljs lka    lkq lks lln llq llx
+       )]) or return;
+TODO: {
+       local $TODO = 'under development';
+       is_deeply(
+               $index->ranges({ pagesize=>10, context=>5 }),
+               # after 'kuap' forwards to 'kzb', 'lgu' shouldn't go back to 'lc'
+               # otherwise we get qw[-k l-]
+               [qw(-k l-lg lgu-)],
+               'lookbehind after full lookahead'
+       );
+}
+       is_deeply(
+               $index->ranges({ pagesize=>10, context=>4 }),
+               [qw(-kt ku-lf lg-)],
+               'maximal lookahead'
+       );
+}
+