7 use Test::Leaner 'no_plan';
9 use Scalar::Vec::Util qw<vcopy SVU_SIZE>;
12 *myfill = *Scalar::Vec::Util::vfill_pp;
13 *myeq = *Scalar::Vec::Util::veq_pp;
22 myfill $_[0], 0, $n, 0;
27 my (undef, $a, $b, $x) = @_;
30 myfill $_[0], 0, $a, $x;
31 myfill $_[0], $a, $b, 1 - $x;
32 myfill $_[0], $a + $b, $n - ($a + $b), $x if $a + $b < $n;
39 my (undef, $n, $desc) = @_;
41 $s .= vec($_[0], $_, 1) for 0 .. $n - 1;
45 my ($v, $c) = ('') x 2;
47 my @s = (0 .. $q, ($p - $q) .. ($p + $q));
50 for my $l (0 .. $n - 1) {
53 next if $l - $x - $y < 0 or $s2 + $l - $y < 0;
54 my $desc = "vcopy [ $x, $y ], $s1, $s2, $l (move)";
55 pat $v, $s1 + $x, $l - $x - $y, 0;
58 myfill $c, $s2, $x, 0 if $x;
59 myfill $c, $s2 + $x, $l - $x - $y, 1;
60 myfill $c, $s2 + $l - $y, $y, 0 if $y;
61 vcopy $v => $s1, $v => $s2, $l;
62 is length $v, length $c, "$desc: length";
63 ok myeq($v, 0, $c, 0, $n), "$desc: bits" or do {
64 diag "n = $n, s1 = $s1, s2 = $s2, l = $l, x = $x, y = $y";
65 prnt $v0, $n, 'original';
67 prnt $c, $n, 'expected';