LU *_* RD 13
Delphi-Mocks提供两个功能:
function CompareValue(const Left,Right : TValue): Integer;
function SameValue(const Left, Right: TValue): Boolean;
Run Code Online (Sandbox Code Playgroud)
有了TValue的记录助手,你也可以做到 TValue.Equals(TValue);
根据Apache条款获得许可,并获得Stefan Glienke的许可.
以下是Stefan的原始资料:delphisorcery.
如果需要扩展变体的功能,请添加:
function TValueHelper.IsVariant: Boolean;
begin
Result := TypeInfo = System.TypeInfo(Variant);
end;
Run Code Online (Sandbox Code Playgroud)
并插入
if Left.IsVariant and Right.IsVariant then
begin
Result := Left.AsVariant = Right.AsVariant;
end else
Run Code Online (Sandbox Code Playgroud)
在SameValue函数中进行isString比较之后.