Beispiel #1
0
 def test_Day8_Example(self):
     answer = [['#', '#', '#', '.', '.', '.', '.'],
               ['#', '#', '#', '.', '.', '.', '.'],
               ['.', '.', '.', '.', '.', '.', '.']]
     screen = day8.Screen(7, 3)
     screen.parse_line('rect 3x2')
     self.assertTrue((screen.screen == answer).all())
Beispiel #2
0
def test_4():
    screen = day8.Screen(7, 3)
    commands = ['rect 3x2', 'rotate column x=1 by 1', 'rotate row y=0 by 4', 'rotate column x=1 by 1']
    result = '''.#..#.#
#.#....
.#.....'''
    screen.run(commands)
    assert str(screen) == result
Beispiel #3
0
def test_1():
    screen = day8.Screen(7, 3)
    commands = ['rect 3x2']
    result = '''###....
###....
.......'''
    screen.run(commands)
    assert str(screen) == result
Beispiel #4
0
 def test_Day8_Example_3(self):
     answer = [['.', '.', '.', '.', '#', '.', '#'],
               ['#', '#', '#', '.', '.', '.', '.'],
               ['.', '#', '.', '.', '.', '.', '.']]
     screen = day8.Screen(7, 3)
     screen.parse_line('rect 3x2')
     screen.parse_line('rotate column x=1 by 1')
     screen.parse_line('rotate row y=0 by 4')
     self.assertTrue((screen.screen == answer).all())
Beispiel #5
0
 def test_Day8_Data(self):
     screen = day8.Screen(50, 6)
     with open('input.txt') as f:
         data = f.read().splitlines()
     self.assertEqual(day8.solve(screen, data), 110)