-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_day11.py
51 lines (40 loc) · 1.7 KB
/
test_day11.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import unittest
import aoc
import day11
class TestDay11(unittest.TestCase):
def test_turning(self):
# pylint: disable=protected-access
bot = day11.PaintingRobot([], None)
self.assertEqual(aoc.Coord(0, 1), bot._direction)
bot.turn_left_and_move()
self.assertEqual(aoc.Coord(-1, 0), bot._direction)
bot.turn_left_and_move()
self.assertEqual(aoc.Coord(0, -1), bot._direction)
bot.turn_left_and_move()
self.assertEqual(aoc.Coord(1, 0), bot._direction)
bot.turn_left_and_move()
self.assertEqual(aoc.Coord(0, 1), bot._direction)
bot.turn_right_and_move()
self.assertEqual(aoc.Coord(1, 0), bot._direction)
bot.turn_right_and_move()
self.assertEqual(aoc.Coord(0, -1), bot._direction)
bot.turn_right_and_move()
self.assertEqual(aoc.Coord(-1, 0), bot._direction)
bot.turn_right_and_move()
self.assertEqual(aoc.Coord(0, 1), bot._direction)
def test_part1_input(self):
result = day11.part1(aoc.read_input('day11.input'))
self.assertEqual(2252, result)
def test_part2_input(self):
result = day11.part2(aoc.read_input('day11.input'))
# Our ship's identifier is AGALRGJE
expected = \
" ** ** ** * *** ** ** **** \n" \
" * * * * * * * * * * * * * \n" \
" * * * * * * * * * * *** \n" \
" **** * ** **** * *** * ** * * \n" \
" * * * * * * * * * * * * * * \n" \
" * * *** * * **** * * *** ** **** \n"
self.assertEqual(expected, result)
if __name__ == '__main__':
unittest.main()