Skip to content

Commit

Permalink
Sort all vectors by g values before comparing them, otherwise the tes…
Browse files Browse the repository at this point in the history
…t is failing for correct submissions under MacOS and Windows (#21)
  • Loading branch information
azarrias authored Feb 23, 2021
1 parent b42701f commit 5ceace1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/utest_rp_a_star_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ TEST_F(RoutePlannerTest, TestAddNeighbors) {
route_planner.AddNeighbors(start_node);

// Correct h and g values for the neighbors of start_node.
std::vector<float> start_neighbor_g_vals{0.10671431, 0.082997195, 0.051776856, 0.055291083};
std::vector<float> start_neighbor_h_vals{1.1828455, 1.0998145, 1.0858033, 1.1831238};
std::vector<float> start_neighbor_g_vals{ 0.051776856, 0.055291083, 0.082997195, 0.10671431 };
std::vector<float> start_neighbor_h_vals{ 1.0858033, 1.1831238, 1.0998145, 1.1828455 };
auto neighbors = start_node->neighbors;
std::sort(std::begin(neighbors), std::end(neighbors),
[](RouteModel::Node* a, RouteModel::Node* b) { return a->g_value < b->g_value; });
EXPECT_EQ(neighbors.size(), 4);

// Check results for each neighbor.
Expand Down

0 comments on commit 5ceace1

Please sign in to comment.