From 58da93286091bcb5e77ebd08e994823d39ed07c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Tue, 19 Dec 2023 17:57:58 +0100 Subject: [PATCH] Added empty skeleton implementations and tests for days 17, 18, and 19 --- AdventOfCode.lpi | 12 ++++ AdventOfCode.lpr | 6 +- solvers/UAplenty.pas | 64 +++++++++++++++++++++ solvers/UClumsyCrucible.pas | 64 +++++++++++++++++++++ solvers/ULavaductLagoon.pas | 64 +++++++++++++++++++++ tests/AdventOfCodeFPCUnit.lpi | 12 ++++ tests/AdventOfCodeFPCUnit.lpr | 2 +- tests/UAplentyTestCases.pas | 90 ++++++++++++++++++++++++++++++ tests/UClumsyCrucibleTestCases.pas | 90 ++++++++++++++++++++++++++++++ tests/ULavaductLagoonTestCases.pas | 90 ++++++++++++++++++++++++++++++ 10 files changed, 492 insertions(+), 2 deletions(-) create mode 100644 solvers/UAplenty.pas create mode 100644 solvers/UClumsyCrucible.pas create mode 100644 solvers/ULavaductLagoon.pas create mode 100644 tests/UAplentyTestCases.pas create mode 100644 tests/UClumsyCrucibleTestCases.pas create mode 100644 tests/ULavaductLagoonTestCases.pas diff --git a/AdventOfCode.lpi b/AdventOfCode.lpi index 2518302..d22fbc2 100644 --- a/AdventOfCode.lpi +++ b/AdventOfCode.lpi @@ -101,6 +101,18 @@ + + + + + + + + + + + + diff --git a/AdventOfCode.lpr b/AdventOfCode.lpr index ea6fe05..7d79baa 100644 --- a/AdventOfCode.lpr +++ b/AdventOfCode.lpr @@ -25,7 +25,8 @@ uses {$ENDIF} Classes, SysUtils, CustApp, USolver, UTrebuchet, UCubeConundrum, UGearRatios, UScratchcards, UGiveSeedFertilizer, UWaitForIt, UCamelCards, UHauntedWasteland, UNumberTheory, UMirageMaintenance, UPipeMaze, UCosmicExpansion, - UHotSprings, UPointOfIncidence, UParabolicReflectorDish, ULensLibrary, UFloorWillBeLava; + UHotSprings, UPointOfIncidence, UParabolicReflectorDish, ULensLibrary, UFloorWillBeLava, UClumsyCrucible, + ULavaductLagoon, UAplenty; type @@ -66,6 +67,9 @@ begin engine.RunAndFree(TParabolicReflectorDish.Create); engine.RunAndFree(TLensLibrary.Create); engine.RunAndFree(TFloorWillBeLava.Create); + engine.RunAndFree(TClumsyCrucible.Create); + engine.RunAndFree(TLavaductLagoon.Create); + engine.RunAndFree(TAplenty.Create); engine.Free; end; diff --git a/solvers/UAplenty.pas b/solvers/UAplenty.pas new file mode 100644 index 0000000..31f9c2a --- /dev/null +++ b/solvers/UAplenty.pas @@ -0,0 +1,64 @@ +{ + Solutions to the Advent Of Code. + Copyright (C) 2023 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 UAplenty; + +{$mode ObjFPC}{$H+} + +interface + +uses + Classes, SysUtils, USolver; + +type + + { TAplenty } + + TAplenty = class(TSolver) + public + procedure ProcessDataLine(const ALine: string); override; + procedure Finish; override; + function GetDataFileName: string; override; + function GetPuzzleName: string; override; + end; + +implementation + +{ TAplenty } + +procedure TAplenty.ProcessDataLine(const ALine: string); +begin + +end; + +procedure TAplenty.Finish; +begin + +end; + +function TAplenty.GetDataFileName: string; +begin + Result := 'aplenty.txt'; +end; + +function TAplenty.GetPuzzleName: string; +begin + Result := 'Day 19: Aplenty'; +end; + +end. + diff --git a/solvers/UClumsyCrucible.pas b/solvers/UClumsyCrucible.pas new file mode 100644 index 0000000..b359285 --- /dev/null +++ b/solvers/UClumsyCrucible.pas @@ -0,0 +1,64 @@ +{ + Solutions to the Advent Of Code. + Copyright (C) 2023 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 UClumsyCrucible; + +{$mode ObjFPC}{$H+} + +interface + +uses + Classes, SysUtils, USolver; + +type + + { TClumsyCrucible } + + TClumsyCrucible = class(TSolver) + public + procedure ProcessDataLine(const ALine: string); override; + procedure Finish; override; + function GetDataFileName: string; override; + function GetPuzzleName: string; override; + end; + +implementation + +{ TClumsyCrucible } + +procedure TClumsyCrucible.ProcessDataLine(const ALine: string); +begin + +end; + +procedure TClumsyCrucible.Finish; +begin + +end; + +function TClumsyCrucible.GetDataFileName: string; +begin + Result := 'clumsy_crucible.txt'; +end; + +function TClumsyCrucible.GetPuzzleName: string; +begin + Result := 'Day 17: Clumsy Crucible'; +end; + +end. + diff --git a/solvers/ULavaductLagoon.pas b/solvers/ULavaductLagoon.pas new file mode 100644 index 0000000..879d63a --- /dev/null +++ b/solvers/ULavaductLagoon.pas @@ -0,0 +1,64 @@ +{ + Solutions to the Advent Of Code. + Copyright (C) 2023 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 ULavaductLagoon; + +{$mode ObjFPC}{$H+} + +interface + +uses + Classes, SysUtils, USolver; + +type + + { TLavaductLagoon } + + TLavaductLagoon = class(TSolver) + public + procedure ProcessDataLine(const ALine: string); override; + procedure Finish; override; + function GetDataFileName: string; override; + function GetPuzzleName: string; override; + end; + +implementation + +{ TLavaductLagoon } + +procedure TLavaductLagoon.ProcessDataLine(const ALine: string); +begin + +end; + +procedure TLavaductLagoon.Finish; +begin + +end; + +function TLavaductLagoon.GetDataFileName: string; +begin + Result := 'lavaduct_lagoon.txt'; +end; + +function TLavaductLagoon.GetPuzzleName: string; +begin + Result := 'Day 18: Lavaduct Lagoon'; +end; + +end. + diff --git a/tests/AdventOfCodeFPCUnit.lpi b/tests/AdventOfCodeFPCUnit.lpi index 082eb5b..b3c0eea 100644 --- a/tests/AdventOfCodeFPCUnit.lpi +++ b/tests/AdventOfCodeFPCUnit.lpi @@ -108,6 +108,18 @@ + + + + + + + + + + + + diff --git a/tests/AdventOfCodeFPCUnit.lpr b/tests/AdventOfCodeFPCUnit.lpr index d7c454d..0f1a515 100644 --- a/tests/AdventOfCodeFPCUnit.lpr +++ b/tests/AdventOfCodeFPCUnit.lpr @@ -7,7 +7,7 @@ uses UGearRatiosTestCases, UScratchcardsTestCases, UGiveSeedFertilizerTestCases, UWaitForItTestCases, UCamelCardsTestCases, UHauntedWastelandTestCases, UMirageMaintenanceTestCases, UPipeMazeTestCases, UCosmicExpansionTestCases, UHotSpringsTestCases, UPointOfIncidenceTestCases, UParabolicReflectorDishTestCases, ULensLibraryTestCases, - UFloorWillBeLavaTestCases; + UFloorWillBeLavaTestCases, UClumsyCrucibleTestCases, ULavaductLagoonTestCases, UAplentyTestCases; {$R *.res} diff --git a/tests/UAplentyTestCases.pas b/tests/UAplentyTestCases.pas new file mode 100644 index 0000000..f53e6de --- /dev/null +++ b/tests/UAplentyTestCases.pas @@ -0,0 +1,90 @@ +{ + Solutions to the Advent Of Code. + Copyright (C) 2023 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 UAplentyTestCases; + +{$mode ObjFPC}{$H+} + +interface + +uses + Classes, SysUtils, fpcunit, testregistry, USolver, UBaseTestCases, UAplenty; + +type + + { TAplentyFullDataTestCase } + + TAplentyFullDataTestCase = class(TEngineBaseTest) + protected + function CreateSolver: ISolver; override; + published + procedure TestPart1; + procedure TestPart2; + end; + + { TAplentyExampleTestCase } + + TAplentyExampleTestCase = class(TExampleEngineBaseTest) + protected + function CreateSolver: ISolver; override; + published + procedure TestPart1; + procedure TestPart2; + end; + +implementation + +{ TAplentyFullDataTestCase } + +function TAplentyFullDataTestCase.CreateSolver: ISolver; +begin + Result := TAplenty.Create; +end; + +procedure TAplentyFullDataTestCase.TestPart1; +begin + AssertEquals(-1, FSolver.GetResultPart1); +end; + +procedure TAplentyFullDataTestCase.TestPart2; +begin + AssertEquals(-1, FSolver.GetResultPart2); +end; + +{ TAplentyExampleTestCase } + +function TAplentyExampleTestCase.CreateSolver: ISolver; +begin + Result := TAplenty.Create; +end; + +procedure TAplentyExampleTestCase.TestPart1; +begin + AssertEquals(19114, FSolver.GetResultPart1); +end; + +procedure TAplentyExampleTestCase.TestPart2; +begin + AssertEquals(-1, FSolver.GetResultPart2); +end; + +initialization + + RegisterTest(TAplentyFullDataTestCase); + RegisterTest(TAplentyExampleTestCase); +end. + diff --git a/tests/UClumsyCrucibleTestCases.pas b/tests/UClumsyCrucibleTestCases.pas new file mode 100644 index 0000000..faeafe1 --- /dev/null +++ b/tests/UClumsyCrucibleTestCases.pas @@ -0,0 +1,90 @@ +{ + Solutions to the Advent Of Code. + Copyright (C) 2023 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 UClumsyCrucibleTestCases; + +{$mode ObjFPC}{$H+} + +interface + +uses + Classes, SysUtils, fpcunit, testregistry, USolver, UBaseTestCases, UClumsyCrucible; + +type + + { TClumsyCrucibleFullDataTestCase } + + TClumsyCrucibleFullDataTestCase = class(TEngineBaseTest) + protected + function CreateSolver: ISolver; override; + published + procedure TestPart1; + procedure TestPart2; + end; + + { TClumsyCrucibleExampleTestCase } + + TClumsyCrucibleExampleTestCase = class(TExampleEngineBaseTest) + protected + function CreateSolver: ISolver; override; + published + procedure TestPart1; + procedure TestPart2; + end; + +implementation + +{ TClumsyCrucibleFullDataTestCase } + +function TClumsyCrucibleFullDataTestCase.CreateSolver: ISolver; +begin + Result := TClumsyCrucible.Create; +end; + +procedure TClumsyCrucibleFullDataTestCase.TestPart1; +begin + AssertEquals(-1, FSolver.GetResultPart1); +end; + +procedure TClumsyCrucibleFullDataTestCase.TestPart2; +begin + AssertEquals(-1, FSolver.GetResultPart2); +end; + +{ TClumsyCrucibleExampleTestCase } + +function TClumsyCrucibleExampleTestCase.CreateSolver: ISolver; +begin + Result := TClumsyCrucible.Create; +end; + +procedure TClumsyCrucibleExampleTestCase.TestPart1; +begin + AssertEquals(102, FSolver.GetResultPart1); +end; + +procedure TClumsyCrucibleExampleTestCase.TestPart2; +begin + AssertEquals(-1, FSolver.GetResultPart2); +end; + +initialization + + RegisterTest(TClumsyCrucibleFullDataTestCase); + RegisterTest(TClumsyCrucibleExampleTestCase); +end. + diff --git a/tests/ULavaductLagoonTestCases.pas b/tests/ULavaductLagoonTestCases.pas new file mode 100644 index 0000000..4f074d5 --- /dev/null +++ b/tests/ULavaductLagoonTestCases.pas @@ -0,0 +1,90 @@ +{ + Solutions to the Advent Of Code. + Copyright (C) 2023 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 ULavaductLagoonTestCases; + +{$mode ObjFPC}{$H+} + +interface + +uses + Classes, SysUtils, fpcunit, testregistry, USolver, UBaseTestCases, ULavaductLagoon; + +type + + { TLavaductLagoonFullDataTestCase } + + TLavaductLagoonFullDataTestCase = class(TEngineBaseTest) + protected + function CreateSolver: ISolver; override; + published + procedure TestPart1; + procedure TestPart2; + end; + + { TLavaductLagoonExampleTestCase } + + TLavaductLagoonExampleTestCase = class(TExampleEngineBaseTest) + protected + function CreateSolver: ISolver; override; + published + procedure TestPart1; + procedure TestPart2; + end; + +implementation + +{ TLavaductLagoonFullDataTestCase } + +function TLavaductLagoonFullDataTestCase.CreateSolver: ISolver; +begin + Result := TLavaductLagoon.Create; +end; + +procedure TLavaductLagoonFullDataTestCase.TestPart1; +begin + AssertEquals(-1, FSolver.GetResultPart1); +end; + +procedure TLavaductLagoonFullDataTestCase.TestPart2; +begin + AssertEquals(-1, FSolver.GetResultPart2); +end; + +{ TLavaductLagoonExampleTestCase } + +function TLavaductLagoonExampleTestCase.CreateSolver: ISolver; +begin + Result := TLavaductLagoon.Create; +end; + +procedure TLavaductLagoonExampleTestCase.TestPart1; +begin + AssertEquals(62, FSolver.GetResultPart1); +end; + +procedure TLavaductLagoonExampleTestCase.TestPart2; +begin + AssertEquals(-1, FSolver.GetResultPart2); +end; + +initialization + + RegisterTest(TLavaductLagoonFullDataTestCase); + RegisterTest(TLavaductLagoonExampleTestCase); +end. +