TDataValue as new global variant type
This commit is contained in:
+1
-1
@@ -37,7 +37,7 @@ uses
|
||||
Myc.Ast in '..\Src\AST\Myc.Ast.pas',
|
||||
Myc.Data.Types.JSON in '..\Src\Data\Myc.Data.Types.JSON.pas',
|
||||
TestDataTypes.JSON in '..\Src\Data\TestDataTypes.JSON.pas',
|
||||
Myc.Data.POD in '..\Src\Data\Myc.Data.POD.pas',
|
||||
Myc.Data.POD in '..\Src\Data\Myc.Data.Scalar.pas',
|
||||
Myc.Data.Decimal in '..\Src\Data\Myc.Data.Decimal.pas',
|
||||
TestDataDecimal in 'TestDataDecimal.pas',
|
||||
TestDataPOD in 'TestDataPOD.pas';
|
||||
|
||||
+3
-1
@@ -138,7 +138,9 @@ $(PreBuildEvent)]]></PreBuildEvent>
|
||||
<DCCReference Include="..\Src\AST\Myc.Ast.pas"/>
|
||||
<DCCReference Include="..\Src\Data\Myc.Data.Types.JSON.pas"/>
|
||||
<DCCReference Include="..\Src\Data\TestDataTypes.JSON.pas"/>
|
||||
<DCCReference Include="..\Src\Data\Myc.Data.POD.pas"/>
|
||||
<DCCReference Include="..\Src\Data\Myc.Data.Scalar.pas">
|
||||
<ModuleName>Myc.Data.POD</ModuleName>
|
||||
</DCCReference>
|
||||
<DCCReference Include="..\Src\Data\Myc.Data.Decimal.pas"/>
|
||||
<DCCReference Include="TestDataDecimal.pas"/>
|
||||
<DCCReference Include="TestDataPOD.pas"/>
|
||||
|
||||
+13
-11
@@ -4,7 +4,7 @@ interface
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
Myc.Data.POD,
|
||||
Myc.Data.Scalar,
|
||||
Myc.Data.Decimal,
|
||||
Myc.Data.Series,
|
||||
DUnitX.TestFramework;
|
||||
@@ -30,8 +30,8 @@ type
|
||||
[TestCase('BooleanTrue', 'True,skBoolean')]
|
||||
[TestCase('BooleanFalse', 'False,skBoolean')]
|
||||
[TestCase('Char', 'Z,skChar')]
|
||||
[TestCase('String', 'Hello World,skString')]
|
||||
[TestCase('StringTruncated', 'This string is definitely longer than 15 chars,skString')]
|
||||
[TestCase('String', 'Hello W,skString')] // Max 7 chars
|
||||
[TestCase('StringTruncated', 'This string is definitely longer than 7 chars,skString')]
|
||||
procedure TestScalarCreation(const AValueStr: string; AExpectedKind: TScalarKind);
|
||||
|
||||
[Test]
|
||||
@@ -226,13 +226,15 @@ var
|
||||
begin
|
||||
// 1. Create a definition
|
||||
recDef :=
|
||||
[
|
||||
TScalarRecordField.Create('ID', skInt64),
|
||||
TScalarRecordField.Create('Name', skString),
|
||||
TScalarRecordField.Create('Price', skDecimal)
|
||||
];
|
||||
Assert.AreEqual(Int64(3), Length(recDef), 'Record definition field count mismatch');
|
||||
Assert.AreEqual('Name', recDef[1].Name, 'Record definition field name mismatch');
|
||||
TScalarRecordDefinition.Create(
|
||||
[
|
||||
TScalarRecordField.Create('ID', skInt64),
|
||||
TScalarRecordField.Create('Name', skString),
|
||||
TScalarRecordField.Create('Price', skDecimal)
|
||||
]
|
||||
);
|
||||
Assert.AreEqual(Int64(3), Length(recDef.Fields), 'Record definition field count mismatch');
|
||||
Assert.AreEqual('Name', recDef.Fields[1].Name, 'Record definition field name mismatch');
|
||||
|
||||
// 2. Create a matching set of values
|
||||
values := [TScalar.FromInt64(99).Value, TScalar.FromString('Product').Value, TScalar.FromDecimal(TDecimal.Create(1995, 2)).Value];
|
||||
@@ -286,7 +288,7 @@ var
|
||||
retrievedRec: TScalarRecord;
|
||||
begin
|
||||
// 1. Define the structure of the records in the series
|
||||
recDef := [TScalarRecordField.Create('ID', skInt64), TScalarRecordField.Create('Price', skDecimal)];
|
||||
recDef := TScalarRecordDefinition.Create([TScalarRecordField.Create('ID', skInt64), TScalarRecordField.Create('Price', skDecimal)]);
|
||||
|
||||
// 2. Create the series with the definition
|
||||
series := TScalarRecordSeries.Create(recDef);
|
||||
|
||||
Reference in New Issue
Block a user