Algorithm-Merge
view release on metacpan or search on metacpan
# `use' statements are after test definition
my $error_message = 'Algorithm::Diff::diff is not symmetric for second and third sequences';
my(@tests, $tests);
BEGIN {
# check sequences of equal length (1 element each)
my @results = (
[ 'u', '', '', '' ],
[ 'r', '', '', 'c' ],
[ 'l', '', 'b', '' ],
[ 'c', '', 'b', 'c' ],
[ 'o', 'a', '', '' ],
[ 'c', 'a', '', 'c' ],
[ 'c', 'a', 'b', '' ],
[ 'c', 'a', 'b', 'c' ],
);
foreach $i (0, 1) {
foreach $j (0, 1) {
foreach $k (0, 1) {
#my($i, $j, $k) = (1, 1, 0); # for testing an individual combination
push @tests, [
[ $i ? 'a' : '' ],
[ $j ? 'b' : '' ],
[ $k ? 'c' : '' ],
[ $results[$i*4 + $j*2 + $k], ],
];
}
}
}
# check sequences, some of which are empty/null sequences ( [] in diff3 call, undef in output)
@results = (
[ ], # no contents in any of the sequences
[ 'r', undef, undef, 'c' ],
[ 'l', undef, 'b', undef ],
[ 'c', undef, 'b', 'c' ],
[ 'o', 'a', undef, undef ],
[ 'r', 'a', undef, 'c' ], # still a problem
[ 'l', 'a', 'b', undef ], # still a problem
[ 'c', 'a', 'b', 'c' ],
);
foreach $i (0, 1) {
foreach $j (0, 1) {
foreach $k (0, 1) {
#my($i, $j, $k) = (1, 1, 0); # for testing an individual combination
push @tests, [
[ ($i ? 'a' : () ) ],
[ ($j ? 'b' : () ) ],
[ ($k ? 'c' : () ) ],
[ $results[$i*4 + $j*2 + $k] ],
];
}
}
}
push @tests, [
[ qw(1 2 3 4 5 6 7) ],
[ qw(1 2 6 7) ],
( run in 0.792 second using v1.01-cache-2.11-cpan-39bf76dae61 )