Fixed initializer of zero polynomial
This commit is contained in:
parent
baa1f8f31f
commit
fa5616f3cc
|
@ -256,6 +256,10 @@ begin
|
||||||
SetLength(Result.FCoefficients, high + 1);
|
SetLength(Result.FCoefficients, high + 1);
|
||||||
for i := 0 to high do
|
for i := 0 to high do
|
||||||
Result.FCoefficients[i] := ACoefficients[i];
|
Result.FCoefficients[i] := ACoefficients[i];
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
SetLength(Result.FCoefficients, 1);
|
||||||
|
Result.FCoefficients[0] := TBigInt.Zero;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,7 @@ type
|
||||||
procedure TestCreateWithDegree(const ACoefficients: array of TBigInt; const ADegree: Integer);
|
procedure TestCreateWithDegree(const ACoefficients: array of TBigInt; const ADegree: Integer);
|
||||||
published
|
published
|
||||||
procedure TestCreate;
|
procedure TestCreate;
|
||||||
procedure TestCreateDegreeOne;
|
|
||||||
procedure TestCreateDegreeZero;
|
procedure TestCreateDegreeZero;
|
||||||
procedure TestCreateDegreeZeroTrim;
|
|
||||||
procedure TestEqual;
|
procedure TestEqual;
|
||||||
procedure TestUnequalSameLength;
|
procedure TestUnequalSameLength;
|
||||||
procedure TestUnequalDifferentLength;
|
procedure TestUnequalDifferentLength;
|
||||||
|
@ -66,19 +64,11 @@ begin
|
||||||
TestCreateWithDegree([992123, 7, 20, 4550022], 3);
|
TestCreateWithDegree([992123, 7, 20, 4550022], 3);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBigIntPolynomialTestCase.TestCreateDegreeOne;
|
|
||||||
begin
|
|
||||||
TestCreateWithDegree([4007], 0);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TBigIntPolynomialTestCase.TestCreateDegreeZero;
|
procedure TBigIntPolynomialTestCase.TestCreateDegreeZero;
|
||||||
begin
|
begin
|
||||||
TestCreateWithDegree([], -1);
|
TestCreateWithDegree([4007], 0);
|
||||||
end;
|
TestCreateWithDegree([], 0);
|
||||||
|
TestCreateWithDegree([0], 0);
|
||||||
procedure TBigIntPolynomialTestCase.TestCreateDegreeZeroTrim;
|
|
||||||
begin
|
|
||||||
TestCreateWithDegree([0], -1);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBigIntPolynomialTestCase.TestEqual;
|
procedure TBigIntPolynomialTestCase.TestEqual;
|
||||||
|
|
Loading…
Reference in New Issue