View Issue Details

IDProjectCategoryView StatusLast Update
0034076FPCFCLpublic2018-08-02 08:04
ReporterFr0sTAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformanyOSanyOS Versionany
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0034076: FPCUnit - add overloads for (U)Int64
DescriptionThe patch provided adds CheckEquals, CheckNotEquals and AssertEquals overloads with (U)Int64 arguments. Note that CheckNotEquals use AssertCount fix I suggested in 0034075
Tagsfpcunit
Fixed in Revision39545
FPCOldBugId
FPCTarget
Attached Files
  • int64-uint64.diff (4,515 bytes)
     .../fcl-fpcunit/src/DUnitCompatibleInterface.inc   | 34 ++++++++++++++++++++++
     packages/fcl-fpcunit/src/fpcunit.pp                | 14 +++++++++
     2 files changed, 48 insertions(+)
    
    diff --git a/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc b/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
    index b99a3d37b0..b9455f3f1f 100644
    --- a/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
    +++ b/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
    @@ -10,11 +10,15 @@
         class procedure CheckEquals(expected, actual: integer; msg: string = ''); overload;
         class procedure CheckEquals(expected, actual: boolean; msg: string = ''); overload;
         class procedure CheckEquals(expected, actual: TClass; msg: string = ''); overload;
    +    class procedure CheckEquals(expected, actual: int64; msg: string = ''); overload;
    +    class procedure CheckEquals(expected, actual: QWord; msg: string = ''); overload;
         class procedure CheckNotEquals(expected, actual: string; msg: string = ''); overload;
         class procedure CheckNotEquals(expected, actual: unicodestring; msg: string = ''); overload;
         class procedure CheckNotEquals(expected, actual: integer; msg: string = ''); overload; virtual;
         class procedure CheckNotEquals(expected, actual: boolean; msg: string = ''); overload; virtual;
         class procedure CheckNotEquals(expected: extended; actual: extended; delta: extended = 0; msg: string = ''); overload; virtual;
    +    class procedure CheckNotEquals(expected, actual: int64; msg: string = ''); overload; virtual;
    +    class procedure CheckNotEquals(expected, actual: QWord; msg: string = ''); overload; virtual;
         class procedure CheckNull(obj: IUnknown; msg: string = ''); overload;
         class procedure CheckNull(obj: TObject; msg: string = ''); overload;
         class procedure CheckNotNull(obj: TObject; msg: string = ''); overload;
    @@ -87,6 +91,18 @@ begin
       AssertEquals(msg, expected, actual);
     end;
     
    +class procedure TAssert.CheckEquals(expected, actual: QWord;
    +  msg: string);
    +begin
    +  AssertEquals(msg, expected, actual);
    +end;
    +
    +class procedure TAssert.CheckEquals(expected, actual: int64;
    +  msg: string);
    +begin
    +  AssertEquals(msg, expected, actual);
    +end;
    +
     class procedure TAssert.CheckNotEquals(expected, actual: string; msg: string);
     begin
       if AnsiCompareStr(Expected, Actual) = 0 then
    @@ -128,6 +144,24 @@ begin
         Inc(AssertCount);
     end;
     
    +class procedure TAssert.CheckNotEquals(expected, actual: QWord;
    +  msg: string);
    +begin
    +  if (expected = actual) then
    +    Fail(msg + ComparisonMsg(IntToStr(expected), IntToStr(actual), false))
    +  else
    +    Inc(AssertCount);
    +end;
    +
    +class procedure TAssert.CheckNotEquals(expected, actual: int64;
    +  msg: string);
    +begin
    +  if (expected = actual) then
    +    Fail(msg + ComparisonMsg(IntToStr(expected), IntToStr(actual), false))
    +  else
    +    Inc(AssertCount);
    +end;
    +
     class procedure TAssert.CheckNull(obj: IUnknown; msg: string);
     begin
       AssertNullIntf(msg, obj);
    diff --git a/packages/fcl-fpcunit/src/fpcunit.pp b/packages/fcl-fpcunit/src/fpcunit.pp
    index e9203920e8..edb7345b5b 100644
    --- a/packages/fcl-fpcunit/src/fpcunit.pp
    +++ b/packages/fcl-fpcunit/src/fpcunit.pp
    @@ -108,6 +108,8 @@ type
         class procedure AssertEquals(Expected, Actual: integer); overload;
         class procedure AssertEquals(const AMessage: string; Expected, Actual: int64); overload;
         class procedure AssertEquals(Expected, Actual: int64); overload;
    +    class procedure AssertEquals(const AMessage: string; Expected, Actual: QWord); overload;
    +    class procedure AssertEquals(Expected, Actual: QWord); overload;
         class procedure AssertEquals(const AMessage: string; Expected, Actual: currency); overload;
         class procedure AssertEquals(Expected, Actual: currency); overload;
         class procedure AssertEquals(const AMessage: string; Expected, Actual, Delta: double); overload;
    @@ -741,6 +743,18 @@ begin
     end;
     
     
    +class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: QWord);
    +begin
    +  AssertTrue(ComparisonMsg(AMessage,IntToStr(Expected), IntToStr(Actual)), Expected = Actual,CallerAddr);
    +end;
    +
    +
    +class procedure TAssert.AssertEquals(Expected, Actual: QWord);
    +begin
    +  AssertTrue(ComparisonMsg(IntToStr(Expected), IntToStr(Actual)), Expected = Actual,CallerAddr);
    +end;
    +
    +
     class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: currency);
     begin
       AssertTrue(ComparisonMsg(AMessage,FloatToStr(Expected), FloatToStr(Actual)), Expected = Actual,CallerAddr);
    
    int64-uint64.diff (4,515 bytes)

Activities

Fr0sT

2018-08-01 18:07

reporter  

int64-uint64.diff (4,515 bytes)
 .../fcl-fpcunit/src/DUnitCompatibleInterface.inc   | 34 ++++++++++++++++++++++
 packages/fcl-fpcunit/src/fpcunit.pp                | 14 +++++++++
 2 files changed, 48 insertions(+)

diff --git a/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc b/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
index b99a3d37b0..b9455f3f1f 100644
--- a/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
+++ b/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
@@ -10,11 +10,15 @@
     class procedure CheckEquals(expected, actual: integer; msg: string = ''); overload;
     class procedure CheckEquals(expected, actual: boolean; msg: string = ''); overload;
     class procedure CheckEquals(expected, actual: TClass; msg: string = ''); overload;
+    class procedure CheckEquals(expected, actual: int64; msg: string = ''); overload;
+    class procedure CheckEquals(expected, actual: QWord; msg: string = ''); overload;
     class procedure CheckNotEquals(expected, actual: string; msg: string = ''); overload;
     class procedure CheckNotEquals(expected, actual: unicodestring; msg: string = ''); overload;
     class procedure CheckNotEquals(expected, actual: integer; msg: string = ''); overload; virtual;
     class procedure CheckNotEquals(expected, actual: boolean; msg: string = ''); overload; virtual;
     class procedure CheckNotEquals(expected: extended; actual: extended; delta: extended = 0; msg: string = ''); overload; virtual;
+    class procedure CheckNotEquals(expected, actual: int64; msg: string = ''); overload; virtual;
+    class procedure CheckNotEquals(expected, actual: QWord; msg: string = ''); overload; virtual;
     class procedure CheckNull(obj: IUnknown; msg: string = ''); overload;
     class procedure CheckNull(obj: TObject; msg: string = ''); overload;
     class procedure CheckNotNull(obj: TObject; msg: string = ''); overload;
@@ -87,6 +91,18 @@ begin
   AssertEquals(msg, expected, actual);
 end;
 
+class procedure TAssert.CheckEquals(expected, actual: QWord;
+  msg: string);
+begin
+  AssertEquals(msg, expected, actual);
+end;
+
+class procedure TAssert.CheckEquals(expected, actual: int64;
+  msg: string);
+begin
+  AssertEquals(msg, expected, actual);
+end;
+
 class procedure TAssert.CheckNotEquals(expected, actual: string; msg: string);
 begin
   if AnsiCompareStr(Expected, Actual) = 0 then
@@ -128,6 +144,24 @@ begin
     Inc(AssertCount);
 end;
 
+class procedure TAssert.CheckNotEquals(expected, actual: QWord;
+  msg: string);
+begin
+  if (expected = actual) then
+    Fail(msg + ComparisonMsg(IntToStr(expected), IntToStr(actual), false))
+  else
+    Inc(AssertCount);
+end;
+
+class procedure TAssert.CheckNotEquals(expected, actual: int64;
+  msg: string);
+begin
+  if (expected = actual) then
+    Fail(msg + ComparisonMsg(IntToStr(expected), IntToStr(actual), false))
+  else
+    Inc(AssertCount);
+end;
+
 class procedure TAssert.CheckNull(obj: IUnknown; msg: string);
 begin
   AssertNullIntf(msg, obj);
diff --git a/packages/fcl-fpcunit/src/fpcunit.pp b/packages/fcl-fpcunit/src/fpcunit.pp
index e9203920e8..edb7345b5b 100644
--- a/packages/fcl-fpcunit/src/fpcunit.pp
+++ b/packages/fcl-fpcunit/src/fpcunit.pp
@@ -108,6 +108,8 @@ type
     class procedure AssertEquals(Expected, Actual: integer); overload;
     class procedure AssertEquals(const AMessage: string; Expected, Actual: int64); overload;
     class procedure AssertEquals(Expected, Actual: int64); overload;
+    class procedure AssertEquals(const AMessage: string; Expected, Actual: QWord); overload;
+    class procedure AssertEquals(Expected, Actual: QWord); overload;
     class procedure AssertEquals(const AMessage: string; Expected, Actual: currency); overload;
     class procedure AssertEquals(Expected, Actual: currency); overload;
     class procedure AssertEquals(const AMessage: string; Expected, Actual, Delta: double); overload;
@@ -741,6 +743,18 @@ begin
 end;
 
 
+class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: QWord);
+begin
+  AssertTrue(ComparisonMsg(AMessage,IntToStr(Expected), IntToStr(Actual)), Expected = Actual,CallerAddr);
+end;
+
+
+class procedure TAssert.AssertEquals(Expected, Actual: QWord);
+begin
+  AssertTrue(ComparisonMsg(IntToStr(Expected), IntToStr(Actual)), Expected = Actual,CallerAddr);
+end;
+
+
 class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: currency);
 begin
   AssertTrue(ComparisonMsg(AMessage,FloatToStr(Expected), FloatToStr(Actual)), Expected = Actual,CallerAddr);
int64-uint64.diff (4,515 bytes)

Michael Van Canneyt

2018-08-02 08:04

administrator   ~0109826

Applied & tested patch, thank you very much for the addition!

Issue History

Date Modified Username Field Change
2018-08-01 18:07 Fr0sT New Issue
2018-08-01 18:07 Fr0sT File Added: int64-uint64.diff
2018-08-01 18:07 Fr0sT Tag Attached: fpcunit
2018-08-01 18:31 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-08-01 18:31 Michael Van Canneyt Status new => assigned
2018-08-02 08:04 Michael Van Canneyt Fixed in Revision => 39545
2018-08-02 08:04 Michael Van Canneyt Note Added: 0109826
2018-08-02 08:04 Michael Van Canneyt Status assigned => resolved
2018-08-02 08:04 Michael Van Canneyt Fixed in Version => 3.1.1
2018-08-02 08:04 Michael Van Canneyt Resolution open => fixed
2018-08-02 08:04 Michael Van Canneyt Target Version => 3.2.0