コード例 #1
0
 def test_send_instructions_multiple_lines(self):
     santa = Santa()
     santa.send_instructions('turn on 0,0 through 999,0\nturn off 0,0 through 499,0\ntoggle 999,999 through 999,999')
     self.assertEqual(501, santa._grid.lights_on_count())
コード例 #2
0
 def test_send_instructions_toggle(self):
     santa = Santa()
     santa.send_instructions('toggle 0,0 through 999,0')
     self.assertEqual(1000, santa._grid.lights_on_count())
     santa.send_instructions('toggle 500,0 through 999,0')
     self.assertEqual(500, santa._grid.lights_on_count())
コード例 #3
0
 def test_send_instructions_off(self):
     santa = Santa()
     santa.send_instructions('turn on 0,0 through 999,0')
     self.assertEqual(1000, santa._grid.lights_on_count())
     santa.send_instructions('turn off 0,0 through 499,0')
     self.assertEqual(500, santa._grid.lights_on_count())
コード例 #4
0
 def test_send_instructions_on_one(self):
     santa = Santa()
     santa.send_instructions('turn on 0,0 through 0,0')
     self.assertEqual(1, santa._grid.lights_on_count())