Recent

Author Topic: int64 support in DUnitCompatibleInterface.inc (fpcunit.pp)  (Read 4301 times)

jc99

  • Hero Member
  • *****
  • Posts: 527
    • My private Site
int64 support in DUnitCompatibleInterface.inc (fpcunit.pp)
« on: November 14, 2015, 05:51:45 pm »
I just wanted to do some testing with my new int64-Function and I came across an error when the results exceed then maxint-limit.
I followed it down to the point that there is no CheckEquals-Function defined in the TAssert class. However there is an AssertEquals-Function
covering int64 but this is not Delphi-compatible.
So how about:
DUnitCompatibleInterface.inc // line 9 ff
Code: [Select]
    class procedure CheckEquals(expected, actual: integer; msg: string = ''); overload;
    class procedure CheckEquals(expected, actual: int64; msg: string = ''); overload; // <--- new line
    class procedure CheckEquals(expected, actual: boolean; msg: string = ''); overload;
[...]
// line 75 New
class procedure TAssert.CheckEquals(expected, actual: int64;  msg: string);
begin
   AssertEquals(msg, expected, actual);
end;
(Lazarus 1.4.4 release)
« Last Edit: November 14, 2015, 11:50:11 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

Leledumbo

  • Hero Member
  • *****
  • Posts: 8108
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: int64 support in DUnitCompatibleInterface.inc (fpcunit.pp)
« Reply #1 on: November 15, 2015, 10:07:04 am »
I don't know where CheckEquals is defined, but I have both FPCUnit and FPTest (highly DUnit compatible) projects sharing the same test cases and they're all using CheckEquals. The only difference is in the uses and RegisterTest call where FPTest suites must be registered with additional .Suite call rather than just the test case type name.

jc99

  • Hero Member
  • *****
  • Posts: 527
    • My private Site
Re: int64 support in DUnitCompatibleInterface.inc (fpcunit.pp)
« Reply #2 on: November 15, 2015, 10:25:53 pm »
it's in
<Lazarusdir>\fpc\packages\fcl-fpcunit\src\

PS: have you tried it with in64 (full range) ?
PPS: I just tried with Delphi 2010, no problem here (CheckEquals with int64 exists)
 
« Last Edit: November 15, 2015, 10:28:14 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

jc99

  • Hero Member
  • *****
  • Posts: 527
    • My private Site
SOLVED: int64 support in DUnitCompatibleInterface.inc (fpcunit.pp)
« Reply #3 on: November 15, 2015, 10:40:31 pm »
Here's the Patch
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren