From: Vincent Pit Date: Mon, 24 Sep 2012 23:03:20 +0000 (+0200) Subject: Also test veq_pp() out of its argument bounds X-Git-Tag: v0.07~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=7fd1958a0919e94beee7223dda577fc9abd3547a;p=perl%2Fmodules%2FScalar-Vec-Util.git Also test veq_pp() out of its argument bounds --- diff --git a/t/10-veq-pp.t b/t/10-veq-pp.t index 58d90b0..7507389 100644 --- a/t/10-veq-pp.t +++ b/t/10-veq-pp.t @@ -33,28 +33,31 @@ sub rst { } sub pat { - my (undef, $a, $b, $x) = @_; + my (undef, $a, $b, $x, $y) = @_; myfill $_[0], 0, $a, $x; myfill $_[0], $a, $b, 1 - $x; - myfill $_[0], $a + $b, $n - ($a + $b), $x; + myfill $_[0], $a + $b, $n - ($a + $b), $x if $y; } -my ($v1, $v2) = ('') x 2; - my @s = ($p - $q) .. ($p + $q); for my $s1 (@s) { for my $s2 (@s) { for my $l (0 .. $n - 1) { next if $s1 + $l > $n or $s2 + $l > $n; - pat $v1, $s1, $l, 0; - pat $v2, $s2, $l, 0; + my $v1 = ''; + my $v2 = ''; + pat $v1, $s1, $l, 0, 0; + pat $v2, $s2, $l, 0, 1; + my $desc = "veq_pp $s1, $s2, $l"; ok Scalar::Vec::Util::veq_pp($v1 => $s1, $v2 => $s2, $l), - "veq_pp $s1, $s2, $l"; + "$desc [1<=>2]"; + ok Scalar::Vec::Util::veq_pp($v2 => $s2, $v1 => $s1, $l), + "$desc [2<=>1]"; if ($l > 0) { ok !Scalar::Vec::Util::veq_pp($v1 => $s1 - 1, $v2 => $s2, $l), - 'not veq_pp ' . ($s1-1) . ", $s2, $l"; + 'not veq_pp ' . ($s1-1) . ", $s2, $l [1<=>2]"; ok !Scalar::Vec::Util::veq_pp($v1 => $s1 + 1, $v2 => $s2, $l), - 'not veq_pp ' . ($s1+1) . ", $s2, $l"; + 'not veq_pp ' . ($s1+1) . ", $s2, $l [1<=>2]"; } } }