File: 20.cycle.t

package info (click to toggle)
liblist-rotation-cycle-perl 1.009-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 112 kB
  • sloc: perl: 25; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 516 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
use Test::More tests => 10;

use List::Rotation::Cycle;

my @array = qw( A B C );

my $c1  = List::Rotation::Cycle->new(@array);
my $c2 = List::Rotation::Cycle->new(@array);

foreach( 1 .. 3 )
{
    is( $c1->next,  $array[0], "First  Cycle is first  element, iteration $_" );
    is( $c2->next,  $array[1], "Second Cycle is second element, iteration $_" );
    is( $c1->next,  $array[2], "First  Cycle is third  element, iteration $_" );
}

is( $c2->next,  $array[0], "First  Cycle is first  element" );