diff --git a/.github/workflows/aoc-tests.yml b/.github/workflows/aoc-tests.yml index 9833f69..0a1d04d 100644 --- a/.github/workflows/aoc-tests.yml +++ b/.github/workflows/aoc-tests.yml @@ -10,6 +10,8 @@ jobs: build: runs-on: ubuntu-latest + env: + ENVIRONMENT: production steps: - uses: actions/checkout@v3 diff --git a/.gitignore b/.gitignore index c10a35e..6396f00 100644 --- a/.gitignore +++ b/.gitignore @@ -245,5 +245,4 @@ dmypy.json # Advent of Code input.txt -input_demo.txt results.md \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index dc5c7be..5f7e752 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ packaging==24.1 pluggy==1.5.0 pytest==8.3.3 pytest-cov==5.0.0 +python-dotenv==1.0.1 diff --git a/year_2024/__init__.py b/year_2024/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/year_2024/day_07_bridge_repair/__init__.py b/year_2024/day_07_bridge_repair/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/year_2024/day_07_bridge_repair/input_demo.txt b/year_2024/day_07_bridge_repair/input_demo.txt new file mode 100644 index 0000000..87b8b25 --- /dev/null +++ b/year_2024/day_07_bridge_repair/input_demo.txt @@ -0,0 +1,9 @@ +190: 10 19 +3267: 81 40 27 +83: 17 5 +156: 15 6 +7290: 6 8 6 15 +161011: 16 10 13 +192: 17 8 14 +21037: 9 7 18 13 +292: 11 6 16 20 \ No newline at end of file diff --git a/year_2024/day_07_bridge_repair/solution_day_07_2024.py b/year_2024/day_07_bridge_repair/solution_day_07_2024.py index dce838d..48cb486 100644 --- a/year_2024/day_07_bridge_repair/solution_day_07_2024.py +++ b/year_2024/day_07_bridge_repair/solution_day_07_2024.py @@ -74,4 +74,3 @@ def solve_day_07_2024(filename: str) -> tuple[int, int] | str: calibration_result_with_concat += calibration_result return calibration_result, calibration_result_with_concat - diff --git a/year_2024/day_07_bridge_repair/test_day_07_2024.py b/year_2024/day_07_bridge_repair/test_day_07_2024.py index b705007..b8bc557 100644 --- a/year_2024/day_07_bridge_repair/test_day_07_2024.py +++ b/year_2024/day_07_bridge_repair/test_day_07_2024.py @@ -1,6 +1,10 @@ import os +from dotenv import load_dotenv from .solution_day_07_2024 import solve_day_07_2024 +load_dotenv() +environment = os.getenv("ENVIRONMENT") + filename_demo = "input_demo.txt" filename = "input.txt" current_dir = os.path.dirname(os.path.abspath(__file__)) @@ -9,8 +13,11 @@ def test_day_07_2024(): - result_demo = solve_day_07_2024(file_path_demo) - assert result_demo == (3749, 11387) - result_one = solve_day_07_2024(file_path) - assert result_one == (7579994664753, 438027111276610) + results_demo = solve_day_07_2024(file_path_demo) + assert results_demo == (3749, 11387) + if environment == "development": + expected_results = (int(os.getenv("SOLUTION_01_DAY_07_2024")), + int(os.getenv("SOLUTION_02_DAY_07_2024"))) + results = solve_day_07_2024(file_path) + assert expected_results == results