Exemplo n.º 1
0
def test_record_best_path(map_40):
    planner = PathPlanner(map_40, 5, 34)
    planner.gScore = {5: 1, 16: 3, 14: 3}
    current_node = 5
    neighbor_node = 16
    planner.record_best_path_to(current_node, neighbor_node)
    came_from_node = planner.cameFrom[neighbor_node]
    g_score = planner.gScore[neighbor_node]
    f_score = planner.fScore[neighbor_node]
    assert current_node == came_from_node
    assert 1.050241214663511 == g_score
    assert 1.57541988984527 == f_score
Exemplo n.º 2
0
def test_get_tentative_gscore(map_40):
    planner = PathPlanner(map_40, 5, 34)
    planner.gScore = {5: 2, 16: 3, 14: 3}
    tentative_gscore = planner.get_tentative_gScore(5, 16)
    assert 2.05024121466351104 == tentative_gscore
Exemplo n.º 3
0
def test_calculate_fscore(map_40):
    planner = PathPlanner(map_40, 5, 34)
    planner.gScore = {5: 1, 16: 3, 14: 3}
    f_score = planner.calculate_fScore(5)
    assert 1.574734871592805 == f_score
Exemplo n.º 4
0
def test_get_gscore(map_40):
    planner = PathPlanner(map_40, 5, 34)
    planner.gScore = {32: 2, 16: 3, 14: 3}
    gscore = planner.get_gScore(16)
    assert 3 == gscore