2021-11-01 16:40:46 +01:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
from solutions.day_06 import Solution
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Day6TestCase(unittest.TestCase):
|
|
|
|
|
def setUp(self):
|
|
|
|
|
self.solution = Solution()
|
|
|
|
|
|
|
|
|
|
def test_count_redistribution_cycles(self):
|
2025-05-06 20:14:58 +02:00
|
|
|
puzzle_input = "0 2 7 0"
|
2021-11-01 16:40:46 +01:00
|
|
|
banks = list(map(int, puzzle_input.split()))
|
|
|
|
|
assert self.solution.redistribute(banks) == (2, 4, 1, 2)
|
|
|
|
|
assert self.solution.redistribute((2, 4, 1, 2)) == (3, 1, 2, 3)
|
|
|
|
|
assert self.solution.redistribute((3, 1, 2, 3)) == (0, 2, 3, 4)
|
|
|
|
|
assert self.solution.redistribute((0, 2, 3, 4)) == (1, 3, 4, 1)
|
|
|
|
|
assert self.solution.redistribute((1, 3, 4, 1)) == (2, 4, 1, 2)
|
|
|
|
|
assert self.solution.solve(puzzle_input) == 5
|
|
|
|
|
|
|
|
|
|
def test_count_redistribution_cycles_again(self):
|
2025-05-06 20:14:58 +02:00
|
|
|
puzzle_input = "0 2 7 0"
|
2021-11-01 16:40:46 +01:00
|
|
|
assert self.solution.solve_again(puzzle_input) == 4
|
|
|
|
|
|
|
|
|
|
|
2025-05-06 20:14:58 +02:00
|
|
|
if __name__ == "__main__":
|
2021-11-01 16:40:46 +01:00
|
|
|
unittest.main()
|