Cleaned up the map for more work.

This commit is contained in:
Zed A. Shaw 2024-09-26 23:14:42 -04:00
parent 4f863c2635
commit 8b67a25732
5 changed files with 46 additions and 20 deletions

View file

@ -17,18 +17,20 @@ TEST_CASE("dijkstra algo test", "[map]") {
json data = load_test_data("./tests/dijkstra.json");
for(auto &test : data) {
Matrix in_map = test["input"];
Matrix walls = test["walls"];
Matrix expected = test["expected"];
int limit = test["limit"];
Matrix res = dijkstra_map(in_map, walls, limit);
Map map(test["input"],
test["walls"],
test["limit"]);
if(res != expected) {
map.make_paths();
Matrix &paths = map.paths();
if(paths != expected) {
println("ERROR! ------");
dump_map("EXPECTED", expected);
dump_map("RESULT", res);
dump_map("RESULT", paths);
}
REQUIRE(res == expected);
REQUIRE(paths == expected);
}
}