Acme-Pills

 view release on metacpan or  search on metacpan

t/base.t  view on Meta::CPAN

	$breakage = 9;
	BreakMe::breakit();
	is( $moving_on, 2, '... potentially breaking for loops early' );
}

my $oos = Acme::Pills::out_of_stock( 'foobar', 'foo/bar.pm' );
like( <$oos>, qr/print.+foobar is out of stock/,
	'out_of_stock() should print an out of stock message' );
ok( ! $INC{'foo/bar.pm'}, '... not populating %INC for module' );

my @breaks = map { Acme::Pills::breaks() ? 1 : () } 1 .. 1000;
cmp_ok( @breaks, '>', 75,
	'breaks() should be true more than 7.5% of the time' );
cmp_ok( @breaks, '<', 125,
	'... and false less than 12.5% of the time' );

my @subs  = map { Acme::Pills::bad_product() } 1 .. 2000;
my @empty = grep { $_ == \&Acme::Pills::empty_box } @subs;
cmp_ok( @empty, '>', 150,
	'empty_box() should be called more than 7.5% of the time' );
cmp_ok( @empty, '<', 250,
	'... and less than 12.5% of the time' );

my @breaking = grep { $_ == \&Acme::Pills::breaks_when_needed } @subs;
cmp_ok( @breaking, '>', 150,
	'breaks_when_needed() should be called more than 7.5% of the time' );
cmp_ok( @breaking, '<', 250,



( run in 0.998 second using v1.01-cache-2.11-cpan-49f99fa48dc )