The next little game in the series where I make a fancy rogue game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
roguish/tests/map.cpp

35 lines
611 B

#include <catch2/catch_test_macros.hpp>
#include "map.hpp"
#include <fmt/core.h>
using namespace fmt;
TEST_CASE("dijkstra algo test", "[map]") {
Matrix in_map = {
{1, 1, 1, 0},
{1, 0, 1, 1},
{1, 0, 1, 1},
{1, 1, 1, 1},
};
Matrix walls = {
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 1, 0},
{0, 0, 1, 0},
};
Matrix expected = {
{1, 1, 1, 0},
{1, 0, 1, 1},
{1, 0, 0, 2},
{1, 1, 0, 3},
};
Matrix res = dijkstra_map(in_map, walls);
println("--- EXPECTED:");
dump_map(expected);
println("--- RESULT:");
dump_map(res);
REQUIRE(res == expected);
}