mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-07 16:56:04 +02:00
41 lines
727 B
ObjectPascal
41 lines
727 B
ObjectPascal
{$mode objfpc}
|
|
{$h+}
|
|
{$hints on}
|
|
{$warnings on}
|
|
|
|
uses
|
|
StrUtils;
|
|
|
|
var
|
|
exitCode: integer = 0;
|
|
|
|
procedure padLeftTest(const s: ansistring;
|
|
n: integer;
|
|
const expectation: ansistring;
|
|
const testnr: integer);
|
|
|
|
begin
|
|
if padLeft(s, n) <> expectation then
|
|
begin
|
|
writeln('Testing strUtils/PadLeft: Test ', testnr,
|
|
' with N = ', n, ' failed.');
|
|
exitCode := 1;
|
|
end;
|
|
end;
|
|
|
|
var
|
|
i, j: integer;
|
|
testString: ansistring;
|
|
|
|
begin
|
|
for i := 1 to 1024 do
|
|
begin
|
|
testString := 'abcd';
|
|
for j := 1 to i - 4 do
|
|
testString := ' ' + testString;
|
|
padLeftTest('abcd', i, testString, i);
|
|
end;
|
|
|
|
halt(exitCode);
|
|
end.
|