I suppose I could preprocess the strings before handing them off to is_string():
use Text::Tabs;
use Test::More tests => 1;
use Test::LongString;
# Apply one or more filters.
# N.B. The order in which the filters are applied matters:
my @strings =
map {tr/\n\r\f //s; $_}
map expand($_) =>
map lc($_) =>
<DATA>;
is_string(
$strings[0],
$strings[1],
'Actually differs by one char'
);
__DATA__
This is a test of Test::LongStrings
this is a test of Test::longstring
As far as the _common_prefix_length function is concerned, perhaps using substr would be a bit faster?
while (length($x) && length($y)) {
- my ($x1,$x2) = $x =~/(.)(.*)/s;
- my ($y1,$y2) = $y =~/(.)(.*)/s;
+ my $x1 = substr($x, 0, 1, '');
+ my $y1 = substr($y, 0, 1, '');
if ($x1 eq $y1) {
- $x = $x2;
- $y = $y2;
++$r;
}
Just in time 0 Comments More | Login | Reply /