Refactored the Trebuchet test cases

This commit is contained in:
Stefan Müller 2023-12-09 01:00:36 +01:00 committed by Stefan Müller
parent 95e06e2b10
commit 269643ad2a
1 changed files with 11 additions and 11 deletions

View File

@ -45,15 +45,15 @@ type
procedure TestPart1; procedure TestPart1;
end; end;
{ TPart2ExampleTrebuchet } { TExample2Trebuchet }
TPart2ExampleTrebuchet = class(TTrebuchet) TExample2Trebuchet = class(TTrebuchet)
function GetDataFileName: string; override; function GetDataFileName: string; override;
end; end;
{ TTrebuchetPart2ExampleTestCase } { TTrebuchetExample2TestCase }
TTrebuchetPart2ExampleTestCase = class(TExampleEngineBaseTest) TTrebuchetExample2TestCase = class(TExampleEngineBaseTest)
protected protected
function CreateSolver: ISolver; override; function CreateSolver: ISolver; override;
published published
@ -91,21 +91,21 @@ begin
AssertEquals(142, FSolver.GetResultPart1); AssertEquals(142, FSolver.GetResultPart1);
end; end;
{ TPart2ExampleTrebuchet } { TExample2Trebuchet }
function TPart2ExampleTrebuchet.GetDataFileName: string; function TExample2Trebuchet.GetDataFileName: string;
begin begin
Result := 'trebuchet_calibration_document2.txt'; Result := 'trebuchet_calibration_document2.txt';
end; end;
{ TTrebuchetPart2ExampleTestCase } { TTrebuchetExample2TestCase }
function TTrebuchetPart2ExampleTestCase.CreateSolver: ISolver; function TTrebuchetExample2TestCase.CreateSolver: ISolver;
begin begin
Result := TPart2ExampleTrebuchet.Create; Result := TExample2Trebuchet.Create;
end; end;
procedure TTrebuchetPart2ExampleTestCase.TestPart2; procedure TTrebuchetExample2TestCase.TestPart2;
begin begin
AssertEquals(281, FSolver.GetResultPart2); AssertEquals(281, FSolver.GetResultPart2);
end; end;
@ -114,5 +114,5 @@ initialization
RegisterTest(TTrebuchetFullDataTestCase); RegisterTest(TTrebuchetFullDataTestCase);
RegisterTest(TTrebuchetExampleTestCase); RegisterTest(TTrebuchetExampleTestCase);
RegisterTest(TTrebuchetPart2ExampleTestCase); RegisterTest(TTrebuchetExample2TestCase);
end. end.