Algorithm-Odometer-Tiny

 view release on metacpan or  search on metacpan

t/algorithm_odometer_tiny.t  view on Meta::CPAN

	while (<$odo>) {
		push @o, $_;
		last if ++$cnt>=100;
	}
	is_deeply \@o, [qw/ 0000 0001 0002 0003 0004 0005 0006 0007 0008
		0009 000a 000b 000c 000d 000e 000f 000g 000h 000i 000j 000k 000l 
		000m 000n 000o 000p 000q 000r 000s 000t 000u 000v 000w 000x 000y 
		000z 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 
		001c 001d 001e 001f 001g 001h 001i 001j 001k 001l 001m 001n 001o 
		001p 001q 001r 001s 001t 001u 001v 001w 001x 001y 001z 0020 0021 
		0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 
		002f 002g 002h 002i 002j 002k 002l 002m 002n 002o 002p 002q 002r /],
			'longer list';
}

{
	my @wheels = ( ['foo','bar'], [3..6], ['quz','baz'] );
	my $odo = Algorithm::Odometer::Gray->new(@wheels);
	# note the following generates two "used only once" warnings on Perls 5.8 thru 5.18, that's ok
	my $exp_len = reduce { $a * $b } map {0+@$_} @wheels; # product() was added in List::Util 1.35
	is $exp_len, 16, 'expected length calc is correct';



( run in 0.448 second using v1.01-cache-2.11-cpan-7add2cbd662 )