30
use strict;
use Test::More q(no_plan);
my @z = qw(1 3 27 38);
my $x = shift();
my $y = shift();
my @test = (
[qw( 4 5) => 1],
[qw( 0 -1) => 1],
[qw(100 100) => 1],
[qw( 10 27) => 1],
[qw( 3 27) => 0],
[qw( 0 100) => 0],
);
sub bool { not not shift }
for(@test) {
my ($x, $y, $works) = @$_;
is(
# 1 2 3
#23456789012345678901234567890
((grep$x<=$_,@z)==grep$y<=$_,@z),
bool($works),
"x=$x y=$y"
);
}
__END__
ok 1 - x=4 y=5
ok 2 - x=0 y=-1
ok 3 - x=100 y=100
ok 4 - x=10 y=27
ok 5 - x=3 y=27
ok 6 - x=0 y=100
1..6
Makeshifts last the longest.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|