You are not logged in.
Pages: 1
This test case fails on version 1.18.5015:
uses
mORMot,
SynCommons;
procedure Test_ArraySorted;
var
VCount: Integer;
VArr, VIntArr: TIntegerDynArray;
VDynArr: TDynArray;
begin
VDynArr.InitSpecific(TypeInfo(TIntegerDynArray), VIntArr, djInteger, @VCount);
SetLength(VArr, 1);
VArr[0] := 1;
VDynArr.AddArray(VArr);
VDynArr.Sort;
Assert(VDynArr.Sorted, 'TDynArray.Sort failed!');
end;
Possible fix (SynCommons.pas):
procedure TDynArray.Sort(aCompare: TDynArraySortCompare);
begin
if Count <= 1 then
fSorted := true // array with 0 or 1 element is always sorted
else
SortRange(0,Count-1,aCompare);
end;
Offline
Please check https://synopse.info/fossil/info/176c855e90
Online
Thank you.
Offline
Pages: 1