{ Solutions to the Advent Of Code. Copyright (C) 2023-2024 Stefan Müller This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . } unit UStepCounterTestCases; {$mode ObjFPC}{$H+} interface uses Classes, SysUtils, fpcunit, testregistry, USolver, UBaseTestCases, UStepCounter; type // Note that the solver implementation does not work with the examples presented // in the puzzle description for part 2, therefore they are not represented here // as test cases. { TStepCounterExampleSteps3TestCase } TStepCounterExampleSteps3TestCase = class(TExampleEngineBaseTest) protected function CreateSolver: ISolver; override; published procedure TestPart1; end; { TStepCounterExampleSteps6TestCase } TStepCounterExampleSteps6TestCase = class(TExampleEngineBaseTest) protected function CreateSolver: ISolver; override; published procedure TestPart1; end; implementation { TStepCounterExampleSteps3TestCase } function TStepCounterExampleSteps3TestCase.CreateSolver: ISolver; begin Result := TStepCounter.Create(3, 3); end; procedure TStepCounterExampleSteps3TestCase.TestPart1; begin AssertEquals(6, FSolver.GetResultPart1); end; { TStepCounterExampleSteps6TestCase } function TStepCounterExampleSteps6TestCase.CreateSolver: ISolver; begin Result := TStepCounter.Create(6, 6); end; procedure TStepCounterExampleSteps6TestCase.TestPart1; begin AssertEquals(16, FSolver.GetResultPart1); end; initialization RegisterTest('TStepCounter', TStepCounterExampleSteps3TestCase); RegisterTest('TStepCounter', TStepCounterExampleSteps6TestCase); end.