mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 16:09:25 +02:00
parent
3d0eac3ee6
commit
17a3ca31ff
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -16149,6 +16149,7 @@ tests/test/units/strings/tstrings1.pp svneol=native#text/plain
|
|||||||
tests/test/units/strutils/taddchar.pp svneol=native#text/plain
|
tests/test/units/strutils/taddchar.pp svneol=native#text/plain
|
||||||
tests/test/units/strutils/taddcharr.pp svneol=native#text/plain
|
tests/test/units/strutils/taddcharr.pp svneol=native#text/plain
|
||||||
tests/test/units/strutils/tbintohex.pp svneol=native#text/plain
|
tests/test/units/strutils/tbintohex.pp svneol=native#text/plain
|
||||||
|
tests/test/units/strutils/tboyer.pp svneol=native#text/pascal
|
||||||
tests/test/units/strutils/tdec2numb.pp svneol=native#text/plain
|
tests/test/units/strutils/tdec2numb.pp svneol=native#text/plain
|
||||||
tests/test/units/strutils/thex2dec.pp svneol=native#text/plain
|
tests/test/units/strutils/thex2dec.pp svneol=native#text/plain
|
||||||
tests/test/units/strutils/thextobin.pp svneol=native#text/plain
|
tests/test/units/strutils/thextobin.pp svneol=native#text/plain
|
||||||
|
@ -429,8 +429,7 @@ begin
|
|||||||
AddMatch(i+1);
|
AddMatch(i+1);
|
||||||
//Only first match ?
|
//Only first match ?
|
||||||
if not aMatchAll then break;
|
if not aMatchAll then break;
|
||||||
inc(i,OldPatternSize);
|
inc(i,DeltaJumpTable2[0]);
|
||||||
inc(i,OldPatternSize);
|
|
||||||
end else begin
|
end else begin
|
||||||
i:=i + Max(DeltaJumpTable1[ord(s[i])],DeltaJumpTable2[j]);
|
i:=i + Max(DeltaJumpTable1[ord(s[i])],DeltaJumpTable2[j]);
|
||||||
end;
|
end;
|
||||||
@ -582,8 +581,7 @@ begin
|
|||||||
AddMatch(i+1);
|
AddMatch(i+1);
|
||||||
//Only first match ?
|
//Only first match ?
|
||||||
if not aMatchAll then break;
|
if not aMatchAll then break;
|
||||||
inc(i,OldPatternSize);
|
inc(i,DeltaJumpTable2[0]);
|
||||||
inc(i,OldPatternSize);
|
|
||||||
end else begin
|
end else begin
|
||||||
i:=i + Max(DeltaJumpTable1[Ord(lCaseArray[Ord(s[i])])],DeltaJumpTable2[j]);
|
i:=i + Max(DeltaJumpTable1[Ord(lCaseArray[Ord(s[i])])],DeltaJumpTable2[j]);
|
||||||
end;
|
end;
|
||||||
|
79
tests/test/units/strutils/tboyer.pp
Normal file
79
tests/test/units/strutils/tboyer.pp
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
{$mode objfpc}
|
||||||
|
|
||||||
|
uses
|
||||||
|
StrUtils;
|
||||||
|
const
|
||||||
|
result1 : array of SizeInt = (1, 4, 7, 10, 13, 16);
|
||||||
|
var
|
||||||
|
a : array of SizeInt;
|
||||||
|
i : LongInt;
|
||||||
|
begin
|
||||||
|
if FindMatchesBoyerMooreCaseSensitive('abcabcabcabcabcabcab','abcab',a,false) then
|
||||||
|
begin
|
||||||
|
if Length(a)<>1 then
|
||||||
|
halt(2);
|
||||||
|
if a[0]<>result1[0] then
|
||||||
|
halt(3);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
halt(1);
|
||||||
|
|
||||||
|
if FindMatchesBoyerMooreCaseSensitive('abcabcabcabcabcabcab','abcab',a,true) then
|
||||||
|
begin
|
||||||
|
if Length(a)<>Length(result1) then
|
||||||
|
halt(12);
|
||||||
|
for i:=Low(a) to High(a) do
|
||||||
|
if a[i]<>result1[i] then
|
||||||
|
halt(13);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
halt(11);
|
||||||
|
|
||||||
|
if FindMatchesBoyerMooreCaseInSensitive('abcabcabcabcabcabcab','abcab',a,false) then
|
||||||
|
begin
|
||||||
|
if Length(a)<>1 then
|
||||||
|
halt(22);
|
||||||
|
if a[0]<>result1[0] then
|
||||||
|
halt(23);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
halt(21);
|
||||||
|
|
||||||
|
{
|
||||||
|
apparently not working yet:
|
||||||
|
|
||||||
|
if FindMatchesBoyerMooreCaseInSensitive('abcabcabcabcabcabcab','abcab',a,true) then
|
||||||
|
begin
|
||||||
|
if Length(a)<>Length(result1) then
|
||||||
|
halt(32);
|
||||||
|
for i:=Low(a) to High(a) do
|
||||||
|
if a[i]<>result1[i] then
|
||||||
|
halt(33);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
halt(31);
|
||||||
|
|
||||||
|
if FindMatchesBoyerMooreCaseInSensitive('abcabcabcAbcabcAbcab','abcaB',a,false) then
|
||||||
|
begin
|
||||||
|
if Length(a)<>1 then
|
||||||
|
halt(42);
|
||||||
|
if a[0]<>result1[0] then
|
||||||
|
halt(43);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
halt(41);
|
||||||
|
|
||||||
|
if FindMatchesBoyerMooreCaseInSensitive('abcabCabcAbcabcABcab','abcaB',a,true) then
|
||||||
|
begin
|
||||||
|
if Length(a)<>Length(result1) then
|
||||||
|
halt(52);
|
||||||
|
for i:=Low(a) to High(a) do
|
||||||
|
if a[i]<>result1[i] then
|
||||||
|
halt(53);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
halt(51);
|
||||||
|
}
|
||||||
|
|
||||||
|
writeln('ok');
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user