mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 02:28:14 +02:00
* PChar -> PAnsiChar
This commit is contained in:
parent
2210a8c845
commit
ab1b45383f
@ -21,18 +21,18 @@
|
||||
class procedure Check(pValue: boolean; const pMessage: string = '');
|
||||
class procedure CheckEquals(expected, actual: extended; const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: extended; delta: extended; const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: string; const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: unicodestring; const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: AnsiString; const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: unicodestring;const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: integer; const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: boolean; const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: TClass; const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: int64; const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: QWord; const msg: string = ''); overload;
|
||||
class procedure CheckNotEquals(expected, actual: string; const msg: string = ''); overload;
|
||||
class procedure CheckEquals(expected, actual: QWord; cons msg: string = ''); overload;
|
||||
class procedure CheckNotEquals(expected, actual: Ansistring; const msg: string = ''); overload;
|
||||
class procedure CheckNotEquals(expected, actual: unicodestring; const msg: string = ''); overload;
|
||||
class procedure CheckNotEquals(expected, actual: integer; const msg: string = ''); overload; virtual;
|
||||
class procedure CheckNotEquals(expected, actual: boolean; const msg: string = ''); overload; virtual;
|
||||
class procedure CheckNotEquals(expected: extended; actual: extended; delta: extended = 0; const msg: string = ''); overload; virtual;
|
||||
class procedure CheckNotEquals(expected: extended; actual: extended; delta: extended = 0; const msg: string = ''); overload; virtual;
|
||||
class procedure CheckNotEquals(expected, actual: int64; const msg: string = ''); overload; virtual;
|
||||
class procedure CheckNotEquals(expected, actual: QWord; const msg: string = ''); overload; virtual;
|
||||
class procedure CheckNull(obj: IUnknown; const msg: string = ''); overload;
|
||||
@ -83,7 +83,8 @@ begin
|
||||
AssertEquals(msg, expected, actual, delta);
|
||||
end;
|
||||
|
||||
class procedure TAssert.CheckEquals(expected, actual: string; const msg: string);
|
||||
class procedure TAssert.CheckEquals(expected, actual: Ansistring; const msg: string);
|
||||
|
||||
begin
|
||||
AssertEquals(msg, expected, actual);
|
||||
end;
|
||||
@ -119,7 +120,7 @@ begin
|
||||
AssertEquals(msg, expected, actual);
|
||||
end;
|
||||
|
||||
class procedure TAssert.CheckNotEquals(expected, actual: string; const msg: string);
|
||||
class procedure TAssert.CheckNotEquals(expected, actual: Ansistring; const msg: string);
|
||||
begin
|
||||
if AnsiCompareStr(Expected, Actual) = 0 then
|
||||
Fail(ComparisonMsg(msg, Expected, Actual, false))
|
||||
@ -127,7 +128,8 @@ begin
|
||||
Inc(AssertCount);
|
||||
end;
|
||||
|
||||
class procedure TAssert.CheckNotEquals(expected, actual: unicodestring; const msg: string);
|
||||
class procedure TAssert.CheckNotEquals(expected, actual: unicodestring; const msg: string ='');
|
||||
|
||||
begin
|
||||
if (Expected=Actual) then
|
||||
Fail(ComparisonMsg(msg, Expected, Actual, false))
|
||||
|
@ -109,7 +109,7 @@ Type
|
||||
FErrors : Integer;
|
||||
FQuiet : Boolean;
|
||||
FSuccess : Boolean;
|
||||
procedure WriteChar(c: char);
|
||||
procedure WriteChar(c: AnsiChar);
|
||||
public
|
||||
Constructor Create(AQuiet : Boolean);
|
||||
destructor Destroy; override;
|
||||
@ -132,10 +132,10 @@ Type
|
||||
TProgressWriter
|
||||
---------------------------------------------------------------------}
|
||||
|
||||
procedure TProgressWriter.WriteChar(c: char);
|
||||
procedure TProgressWriter.WriteChar(c: AnsiChar);
|
||||
begin
|
||||
write(c);
|
||||
// flush output, so that we see the char immediately, even it is written to file
|
||||
// flush output, so that we see the AnsiChar immediately, even it is written to file
|
||||
Flush(output);
|
||||
end;
|
||||
|
||||
|
@ -299,7 +299,7 @@ end;
|
||||
|
||||
procedure TAssertTest.TestEqualsChar;
|
||||
var
|
||||
a, b: char;
|
||||
a, b: AnsiChar;
|
||||
begin
|
||||
a := 'a';
|
||||
b := 'a';
|
||||
@ -434,7 +434,7 @@ end;
|
||||
|
||||
procedure TAssertTest.FailEqualsChar;
|
||||
var
|
||||
a, b: char;
|
||||
a, b: AnsiChar;
|
||||
begin
|
||||
a := 'a';
|
||||
b := 'b';
|
||||
|
@ -98,8 +98,10 @@ type
|
||||
class procedure AssertTrue(ACondition: boolean); overload;
|
||||
class procedure AssertFalse(const AMessage: string; ACondition: boolean; AErrorAddrs: Pointer = nil); overload;
|
||||
class procedure AssertFalse(ACondition: boolean); overload;
|
||||
class procedure AssertEquals(const AMessage: string; Expected, Actual: string); overload;
|
||||
class procedure AssertEquals(Expected, Actual: string); overload;
|
||||
class procedure AssertEquals(const AMessage: string; Expected: AnsiString; Actual: UnicodeString); overload;
|
||||
class procedure AssertEquals(const AMessage: string; Expected: UnicodeString; Actual: AnsiString); overload;
|
||||
class procedure AssertEquals(const AMessage: string; Expected, Actual: Ansistring); overload;
|
||||
class procedure AssertEquals(Expected, Actual: Ansistring); overload;
|
||||
class procedure AssertEquals(const AMessage: string; Expected, Actual: UnicodeString); overload;
|
||||
class procedure AssertEquals(Expected, Actual: UnicodeString); overload;
|
||||
class procedure AssertEquals(const AMessage: string; Expected, Actual: integer); overload;
|
||||
@ -114,8 +116,8 @@ type
|
||||
class procedure AssertEquals(Expected, Actual, Delta: double); overload;
|
||||
class procedure AssertEquals(const AMessage: string; Expected, Actual: boolean); overload;
|
||||
class procedure AssertEquals(Expected, Actual: boolean); overload;
|
||||
class procedure AssertEquals(const AMessage: string; Expected, Actual: char); overload;
|
||||
class procedure AssertEquals(Expected, Actual: char); overload;
|
||||
class procedure AssertEquals(const AMessage: string; Expected, Actual: AnsiChar); overload;
|
||||
class procedure AssertEquals(Expected, Actual: AnsiChar); overload;
|
||||
class procedure AssertEquals(const AMessage: string; Expected, Actual: TClass); overload;
|
||||
class procedure AssertEquals(Expected, Actual: TClass); overload;
|
||||
class procedure AssertSame(const AMessage: string; Expected, Actual: TObject); overload;
|
||||
@ -332,7 +334,7 @@ type
|
||||
property StartingTime: TDateTime read FStartingTime;
|
||||
end;
|
||||
|
||||
function ComparisonMsg(const aExpected: string; const aActual: string; const aCheckEqual: boolean=true): string; overload;
|
||||
function ComparisonMsg(const aExpected: AnsiString; const aActual: AnsiString; const aCheckEqual: boolean=true): AnsiString; overload;
|
||||
function ComparisonMsg(const aExpected: UnicodeString; const aActual: UnicodeString; const aCheckEqual: boolean=true): Unicodestring; overload;
|
||||
function ComparisonMsg(const aMsg: string; const aExpected: string; const aActual: string; const aCheckEqual: boolean=true): string; overload;
|
||||
|
||||
@ -426,7 +428,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function ComparisonMsg(const aExpected: string; const aActual: string; const aCheckEqual: boolean=true): string;
|
||||
function ComparisonMsg(const aExpected: Ansistring; const aActual: AnsiString; const aCheckEqual: boolean=true): AnsiString;
|
||||
// aCheckEqual=false gives the error message if the test does *not* expect the results to be the same.
|
||||
begin
|
||||
if aCheckEqual then
|
||||
@ -682,25 +684,38 @@ begin
|
||||
AssertFalse('', ACondition,CallerAddr);
|
||||
end;
|
||||
|
||||
class procedure TAssert.AssertEquals(const AMessage: string;
|
||||
Expected: AnsiString; Actual: UnicodeString);
|
||||
begin
|
||||
AssertTrue(ComparisonMsg(AMessage ,UnicodeString(Expected), Actual), UnicodeString(Expected)=Actual,CallerAddr);
|
||||
end;
|
||||
|
||||
class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: string);
|
||||
class procedure TAssert.AssertEquals(const AMessage: string;
|
||||
Expected: UnicodeString; Actual: AnsiString);
|
||||
begin
|
||||
AssertTrue(ComparisonMsg(AMessage ,Expected, UnicodeString(Actual)), Expected=UnicodeString(Actual),CallerAddr);
|
||||
end;
|
||||
|
||||
|
||||
class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: Ansistring);
|
||||
begin
|
||||
AssertTrue(ComparisonMsg(AMessage ,Expected, Actual), Expected=Actual,CallerAddr);
|
||||
end;
|
||||
|
||||
|
||||
class procedure TAssert.AssertEquals(Expected, Actual: string);
|
||||
class procedure TAssert.AssertEquals(Expected, Actual: Ansistring);
|
||||
begin
|
||||
AssertTrue(ComparisonMsg(Expected, Actual), Expected=Actual,CallerAddr);
|
||||
end;
|
||||
|
||||
class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: Unicodestring);
|
||||
class procedure TAssert.AssertEquals(const AMessage: string; Expected,
|
||||
Actual: UnicodeString);
|
||||
begin
|
||||
AssertTrue(ComparisonMsg(AMessage ,Expected, Actual), Expected=Actual,CallerAddr);
|
||||
end;
|
||||
|
||||
|
||||
class procedure TAssert.AssertEquals(Expected, Actual: Unicodestring);
|
||||
class procedure TAssert.AssertEquals(Expected, Actual: UnicodeString);
|
||||
begin
|
||||
AssertTrue(ComparisonMsg(Expected, Actual), Expected=Actual,CallerAddr);
|
||||
end;
|
||||
@ -793,13 +808,13 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: char);
|
||||
class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: AnsiChar);
|
||||
begin
|
||||
AssertTrue(ComparisonMsg(AMessage,Expected, Actual), Expected = Actual,CallerAddr);
|
||||
end;
|
||||
|
||||
|
||||
class procedure TAssert.AssertEquals(Expected, Actual: char);
|
||||
class procedure TAssert.AssertEquals(Expected, Actual: AnsiChar);
|
||||
begin
|
||||
AssertTrue(ComparisonMsg(Expected, Actual), Expected = Actual,CallerAddr);
|
||||
end;
|
||||
|
@ -17,6 +17,9 @@
|
||||
program frameworktest;
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}
|
||||
cwstring,
|
||||
{$endif}
|
||||
consoletestrunner, classes, SysUtils, fpcunit, testreport, asserttest,
|
||||
suitetest;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user