File: rt126034.t

package info (click to toggle)
libarray-iterator-perl 0.135-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 240 kB
  • sloc: perl: 730; makefile: 2
file content (21 lines) | stat: -rwxr-xr-x 568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env perl

use strict;
use warnings;

use Test::Most;

BEGIN { use_ok('Array::Iterator::BiDirectional') }

my @set = qw/ one two three four /;
my $iterator = Array::Iterator::BiDirectional->new(@set);

cmp_ok($iterator->getNext(), 'eq', 'one');
cmp_ok($iterator->getNext(), 'eq', 'two');
cmp_ok($iterator->getNext(), 'eq', 'three');
cmp_ok($iterator->getPrevious(), 'eq', 'two');
cmp_ok($iterator->getPrevious(), 'eq', 'one');
ok(!$iterator->hasPrevious(), '... we should have no more');
ok($iterator->hasNext(), '... we should have more');

done_testing();