Skip to content

Commit

Permalink
Merge pull request #216 from Stegallo/2015
Browse files Browse the repository at this point in the history
day 11
  • Loading branch information
Stegallo authored Nov 18, 2023
2 parents 930a18e + 2804321 commit 6b93a88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
20 changes: 8 additions & 12 deletions tests/y_2015/test_2015_day11.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,11 @@ def test_pairs():
assert pairs("abbcegjk") is False


# def test_calculate_1():
# day._Day__input_data = ["1"]
# day._apply_times = MagicMock()
# day._calculate_1()
# day._apply_times.assert_called_once_with(["1"], 40)
#
#
# def test_calculate_2():
# day._Day__input_data = ["1"]
# day._apply_times = MagicMock()
# day._calculate_2()
# day._apply_times.assert_called_once_with(["1"], 50)
def test_calculate_1():
day._Day__input_data = ["a"]
assert day._calculate_1() == "aabcc"


def test_calculate_2():
day._Day__input_data = ["a"]
assert day._calculate_2() == "bbcdd"
3 changes: 1 addition & 2 deletions y_2015/day11.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ def _calculate_1(self) -> str:
proposed_pwd = increment_string(self.__input_data)
while not valid(proposed_pwd):
proposed_pwd = increment_string(proposed_pwd)
self.cached_solution_1 = proposed_pwd
return proposed_pwd

def _calculate_2(self) -> str:
x = self.cached_solution_1
x = self._calculate_1()
proposed_pwd = increment_string(x)
while not valid(proposed_pwd):
proposed_pwd = increment_string(proposed_pwd)
Expand Down

0 comments on commit 6b93a88

Please sign in to comment.