RTL custom interface types as records

This commit is contained in:
Michael Schimmel
2025-12-11 14:22:09 +01:00
parent 3ed5a4011f
commit 18dde168fd
13 changed files with 918 additions and 84 deletions
-21
View File
@@ -23,8 +23,6 @@ type
[TestCase('Float_Negative', '-3.1415926535,Float')]
procedure TestScalarCreation(const AValueStr: string; AExpectedKind: TScalar.TKind);
[Test]
procedure TestScalarTuple;
end;
implementation
@@ -56,25 +54,6 @@ begin
end;
end;
procedure TTestPOD.TestScalarTuple;
var
tuple: TScalarTuple;
begin
// A tuple is a heterogeneous array of TScalar
SetLength(tuple, 3);
tuple[0] := TScalar.FromInt64(123);
tuple[1] := TScalar.FromDouble(3.14);
tuple[2] := TScalar.FromInt64(-456);
Assert.AreEqual(Int64(3), Length(tuple), 'Tuple length mismatch');
Assert.AreEqual(TScalar.TKind.Ordinal, tuple[0].Kind, 'Tuple item 0 kind mismatch');
Assert.AreEqual(Int64(123), tuple[0].Value.AsInt64, 'Tuple item 0 value mismatch');
Assert.AreEqual(TScalar.TKind.Float, tuple[1].Kind, 'Tuple item 1 kind mismatch');
Assert.AreEqual(3.14, tuple[1].Value.AsDouble, 1E-12, 'Tuple item 1 value mismatch');
Assert.AreEqual(TScalar.TKind.Ordinal, tuple[2].Kind, 'Tuple item 2 kind mismatch');
Assert.AreEqual(Int64(-456), tuple[2].Value.AsInt64, 'Tuple item 2 value mismatch');
end;
initialization
FormatSettings.DecimalSeparator := '.';
TDUnitX.RegisterTestFixture(TTestPOD);