Algorithm-Odometer-Tiny

 view release on metacpan or  search on metacpan

t/algorithm_odometer_tiny.t  view on Meta::CPAN

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
SKIP: {
        skip "need Perl >= v5.18 for overloaded <> in list context",
                2 if $] lt '5.018'; # [perl #47119]
        my $odo1 = Algorithm::Odometer::Tiny->new( ['foo','bar'], [3..5] );
        is_deeply [<$odo1>], ["foo3", "foo4", "foo5", "bar3", "bar4", "bar5"], 'list context <> ::Tiny';
        my $odo2 = Algorithm::Odometer::Gray->new( ['a','b','c'],[1,2] );
        is_deeply [<$odo2>], ["a1", "b1", "c1", "c2", "b2", "a2"], 'list context <> ::Gray';
}
 
subtest 'errors' => sub { plan tests=>4;
        like exception { Algorithm::Odometer::Tiny->new() }, qr/\bno wheels specified\b/i, 'no wheels specified';
        like exception { Algorithm::Odometer::Gray->new() }, qr/\bno wheels specified\b/i, 'no wheels specified ::Gray';
        like exception { Algorithm::Odometer::Gray->new(['x','y'],['z']) }, qr/\bat least two positions\b/i, 'Gray at least two positions 1/2';
        like exception { Algorithm::Odometer::Gray->new(['x','y'],[]) }, qr/\bat least two positions\b/i, 'Gray at least two positions 2/2';
};
 
if ( my $cnt = grep {!$_} Test::More->builder->summary )
        { BAIL_OUT("$cnt tests failed") }
done_testing(TESTCOUNT);



( run in 0.315 second using v1.01-cache-2.11-cpan-95122f20152 )