Test coverage back and save system should work again but have to confirm it in-game.

This commit is contained in:
Zed A. Shaw 2024-12-02 09:58:54 -05:00
parent 6b4ebf7629
commit 2576b16869
9 changed files with 43 additions and 31 deletions

View file

@ -3,6 +3,7 @@
#include <nlohmann/json.hpp>
#include <fstream>
#include "map.hpp"
#include "worldbuilder.hpp"
using namespace fmt;
using namespace nlohmann;
@ -13,6 +14,22 @@ json load_test_data(const string &fname) {
return json::parse(infile);
}
TEST_CASE("camera control", "[map]") {
Map map(20, 20);
WorldBuilder builder(map);
builder.generate();
Point center = map.center_camera({10,10}, 5, 5);
REQUIRE(center.x == 8);
REQUIRE(center.y == 8);
Point translation = map.map_to_camera({10,10}, center);
REQUIRE(translation.x == 2);
REQUIRE(translation.y == 2);
}
TEST_CASE("dijkstra algo test", "[map]") {
json data = load_test_data("./tests/dijkstra.json");