feat(punit): add AssertEquals overload for UInt64, register UInt64ToStr built-in

PtrUInt (= UInt64) had no matching AssertEquals overload, causing
ambiguous-overload errors in test_blaise_mem. Added the UInt64 overload
to punit and registered UInt64ToStr in the symbol table (it was already
handled in semantic + codegen but missing from the built-in registry).

Reverts the Pointer-cast workaround from the previous commit — the test
now uses PtrUInt directly as intended.
This commit is contained in:
Graeme Geldenhuys 2026-06-07 12:31:04 +01:00
parent 64060a542d
commit 58f6a050db
3 changed files with 11 additions and 1 deletions

View file

@ -1543,6 +1543,8 @@ begin
Define(Sym);
Sym := TSymbol.Create('Int64ToStr', skFunction, FTypeString);
Define(Sym);
Sym := TSymbol.Create('UInt64ToStr', skFunction, FTypeString);
Define(Sym);
Sym := TSymbol.Create('DoubleToStr', skFunction, FTypeString);
Define(Sym);
Sym := TSymbol.Create('SingleToStr', skFunction, FTypeString);

View file

@ -300,6 +300,7 @@ function AssertEquals(AMessage : string; const AExpected, AActual : Byte) : Bool
function AssertEquals(AMessage : string; const AExpected, AActual : Integer) : Boolean; overload;
function AssertEquals(AMessage : string; const AExpected, AActual : Cardinal) : Boolean; overload;
function AssertEquals(AMessage : string; const AExpected, AActual : Int64) : Boolean; overload;
function AssertEquals(AMessage : string; const AExpected, AActual : UInt64) : Boolean; overload;
function AssertEquals(AMessage : string; const AExpected, AActual : Double) : Boolean; overload;
function AssertEquals(AMessage : string; const AExpected, AActual, ADelta : Double) : Boolean; overload;
@ -1296,6 +1297,13 @@ begin
AExpected = AActual);
end;
function AssertEquals(AMessage : string; const AExpected, AActual : UInt64) : Boolean; overload;
begin
Result := AssertTrue(
AMessage + '. ' + ExpectMessage(UInt64ToStr(AExpected), UInt64ToStr(AActual)),
AExpected = AActual);
end;
function AssertEquals(AMessage : string; const AExpected, AActual, ADelta : Double) : Boolean; overload;
var
Effective : Double;

View file

@ -500,7 +500,7 @@ begin
_BlaiseFreeMem(A);
B := _BlaiseGetMem(65536);
AssertNotNull('second large', B);
AssertEquals('cache returns same block', Pointer(A), Pointer(B));
AssertEquals('cache returns same block', PtrUInt(A), PtrUInt(B));
_BlaiseFreeMem(B);
Result := '';
end;