Added polynomial degree and coefficients as public properties
This commit is contained in:
@@ -29,7 +29,13 @@ type
|
||||
{ TBigIntPolynomialTestCase }
|
||||
|
||||
TBigIntPolynomialTestCase = class(TTestCase)
|
||||
private
|
||||
procedure TestCreateWithDegree(const ACoefficients: array of TBigInt; const ADegree: Integer);
|
||||
published
|
||||
procedure TestCreate;
|
||||
procedure TestCreateDegreeOne;
|
||||
procedure TestCreateDegreeZero;
|
||||
procedure TestCreateDegreeZeroTrim;
|
||||
procedure TestEqual;
|
||||
procedure TestUnequalSameLength;
|
||||
procedure TestUnequalDifferentLength;
|
||||
@@ -41,6 +47,34 @@ implementation
|
||||
|
||||
{ TBigIntPolynomialTestCase }
|
||||
|
||||
procedure TBigIntPolynomialTestCase.TestCreateWithDegree(const ACoefficients: array of TBigInt; const ADegree: Integer);
|
||||
var
|
||||
a: TBigIntPolynomial;
|
||||
begin
|
||||
a := TBigIntPolynomial.Create(ACoefficients);
|
||||
AssertEquals('Degree of created polynomial incorrect.', ADegree, a.Degree);
|
||||
end;
|
||||
|
||||
procedure TBigIntPolynomialTestCase.TestCreate;
|
||||
begin
|
||||
TestCreateWithDegree([992123, 7, 20, 4550022], 3);
|
||||
end;
|
||||
|
||||
procedure TBigIntPolynomialTestCase.TestCreateDegreeOne;
|
||||
begin
|
||||
TestCreateWithDegree([4007], 0);
|
||||
end;
|
||||
|
||||
procedure TBigIntPolynomialTestCase.TestCreateDegreeZero;
|
||||
begin
|
||||
TestCreateWithDegree([], -1);
|
||||
end;
|
||||
|
||||
procedure TBigIntPolynomialTestCase.TestCreateDegreeZeroTrim;
|
||||
begin
|
||||
TestCreateWithDegree([0], -1);
|
||||
end;
|
||||
|
||||
procedure TBigIntPolynomialTestCase.TestEqual;
|
||||
var
|
||||
a, b: TBigIntPolynomial;
|
||||
|
||||
Reference in New Issue
Block a user