diff --git a/include/graaflib/algorithm/shortest_path/a_star.tpp b/include/graaflib/algorithm/shortest_path/a_star.tpp index 3f8fc8e3..c39e6524 100644 --- a/include/graaflib/algorithm/shortest_path/a_star.tpp +++ b/include/graaflib/algorithm/shortest_path/a_star.tpp @@ -60,9 +60,10 @@ std::optional> a_star_search( // A* search does not work on negative edge weights. if (edge_weight < 0) { - throw std::invalid_argument{fmt::format( - "Negative edge weight [{}] between vertices [{}] -> [{}].", - edge_weight, current.id, neighbor)}; + throw std::invalid_argument{ + "Negative edge weight [" + std::to_string(edge_weight) + + "] between vertices [" + std::to_string(current.id) + "] -> [" + + std::to_string(neighbor) + "]."}; } // tentative_g_score is the distance from start to the neighbor through diff --git a/test/graaflib/algorithm/shortest_path/a_star_test.cpp b/test/graaflib/algorithm/shortest_path/a_star_test.cpp index e3c67e0a..ec27bd0e 100644 --- a/test/graaflib/algorithm/shortest_path/a_star_test.cpp +++ b/test/graaflib/algorithm/shortest_path/a_star_test.cpp @@ -193,7 +193,7 @@ TYPED_TEST(AStarShortestPathSignedTypesTest, AStarNegativeWeight) { ex.what(), fmt::format( "Negative edge weight [{}] between vertices [{}] -> [{}].", - -1, vertex_id_1, vertex_id_2)); + std::to_string(weight_t{-1}), vertex_id_1, vertex_id_2)); throw; } },