Пример #1
0
def test_longer_manhattan_distance():
    path1 = ["R75", "D30", "R83", "U83", "L12", "D49", "R71", "U7", "L72"]
    path2 = ["U62", "R66", "U55", "R34", "D71", "R55", "D58", "R83"]

    res = day3.manhattan_distance(path1, path2)

    assert res == 159
Пример #2
0
def test_manhattan_distance():
    path1 = ["R8", "U5", "L5", "D3"]
    path2 = ["U7", "R6", "D4", "L4"]

    res = day3.manhattan_distance(path1, path2)

    assert res == 6
Пример #3
0
 def test_manhattan_distance(self):
     checklist = [(((0, 0), (1, 0)), 1), (((1, 0), (0, 0)), 1),
                  (((20, 0), (0, 0)), 20), (((20, 0), (0, 20)), 40)]
     for check in checklist:
         with self.subTest(check=check):
             self.assertEqual(
                 day3.manhattan_distance(check[0][0], check[0][1]),
                 check[1])
Пример #4
0
 def test_manhattan_distance(self):
     p1 = (0, 0)
     p2 = (3, 3)
     self.assertEqual(day3.manhattan_distance(p1, p2), 6)
Пример #5
0
def test_manhattan2():
    assert manhattan_distance((0, 0), (155, 4)) == 159
Пример #6
0
def test_manhattan():
    assert manhattan_distance((0, 0), (3, 3)) == 6
Пример #7
0
def test_manhattan3():
    assert manhattan_distance((0, 0), (158, -12)) == 170