Fixed calculation of root-isolating intervals and tests
This commit is contained in:
@@ -49,20 +49,22 @@ procedure TPolynomialRootsTestCase.AssertBisectResult(constref AIsolatingInterva
|
||||
AExpectedRoots: array of Cardinal);
|
||||
var
|
||||
exp: Cardinal;
|
||||
ri: TIsolatingInterval;
|
||||
found: Boolean;
|
||||
i, foundIndex: Integer;
|
||||
begin
|
||||
AssertEquals('Unexpected number of isolating intervals.', Length(AExpectedRoots), AIsolatingIntervals.Count);
|
||||
for exp in AExpectedRoots do
|
||||
begin
|
||||
found := False;
|
||||
for ri in AIsolatingIntervals do
|
||||
if (ri.A <= exp) and (exp <= ri.B) then
|
||||
for i := 0 to AIsolatingIntervals.Count - 1 do
|
||||
if (AIsolatingIntervals[i].A <= exp) and (exp <= AIsolatingIntervals[i].B) then
|
||||
begin
|
||||
found := True;
|
||||
foundIndex := i;
|
||||
Break;
|
||||
end;
|
||||
AssertTrue('No isolating interval for expected root ' + IntToStr(exp) + ' found.', found);
|
||||
AIsolatingIntervals.Delete(foundIndex);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user