Exemple #1
0
def tests_simple():
    r = read_data("world1.txt")
    c = World(r[1])
    w = r[2]
    rc = r[3]
    rb = robot(int(rc[0][1]), int(rc[0][2]))
    print(rb.current_position())
    for i in range(len(r[2])):
        c.setWalls(int(w[i][1]), int(w[i][2]))

    print(c.map)
    print()
    rb.move_robot(4, 1, c.map, r[1])
    print(rb.current_position())
    rb.move_robot(9, 1, c.map, r[1])
    print(rb.current_position())
    rb.move_robot(7, 0, c.map, r[1])
    if (rb.goal_reached(7, 0)):
        print("goal reached")
 def test_say_2_when_2(self):
     self.assertEqual(robot(2), '2')
 def test_say_1_when_1(self):
     self.assertEqual(robot(1), '1')
 def test_say_fizzbuzz_when_15(self):
     self.assertEqual(robot(15), 'fizzbuzz')
 def test_say_14_when_14(self):
     self.assertEqual(robot(14), '14')
 def test_say_13_when_13(self):
     self.assertEqual(robot(13), '13')
 def test_say_fizz_when_12(self):
     self.assertEqual(robot(12), 'fizz')
 def test_say_buzz_when_10(self):
     self.assertEqual(robot(10), 'buzz')
 def test_say_fizz_when_9(self):
     self.assertEqual(robot(9), 'fizz')
 def test_say_8_when_8(self):
     self.assertEqual(robot(8), '8')
 def test_say_7_when_7(self):
     self.assertEqual(robot(7), '7')
 def test_say_buzz_when_5(self):
     self.assertEqual(robot(5), 'buzz')
 def test_say_4_when_4(self):
     self.assertEqual(robot(4), '4')