Test coverage back and save system should work again but have to confirm it in-game.
This commit is contained in:
parent
6b4ebf7629
commit
2576b16869
9 changed files with 43 additions and 31 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <nlohmann/json.hpp>
|
||||
#include <fstream>
|
||||
#include "map.hpp"
|
||||
#include "worldbuilder.hpp"
|
||||
#include "lights.hpp"
|
||||
#include "point.hpp"
|
||||
|
||||
|
@ -10,7 +11,8 @@ using namespace lighting;
|
|||
|
||||
TEST_CASE("lighting a map works", "[lighting]") {
|
||||
Map map(20,20);
|
||||
map.generate();
|
||||
WorldBuilder builder(map);
|
||||
builder.generate();
|
||||
|
||||
Point light1 = map.place_entity(0);
|
||||
Point light2 = map.place_entity(1);
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <optional>
|
||||
#include <iostream>
|
||||
#include "map.hpp"
|
||||
#include "worldbuilder.hpp"
|
||||
#include "tser.hpp"
|
||||
|
||||
using namespace fmt;
|
||||
|
@ -54,10 +55,10 @@ TEST_CASE("test using tser for serialization", "[config]") {
|
|||
}
|
||||
|
||||
TEST_CASE("basic save a world", "[save]") {
|
||||
/*
|
||||
DinkyECS::World world;
|
||||
Map map(20, 20);
|
||||
map.generate();
|
||||
WorldBuilder builder(map);
|
||||
builder.generate();
|
||||
|
||||
// configure a player as a fact of the world
|
||||
Player player{world.entity()};
|
||||
|
@ -99,5 +100,4 @@ TEST_CASE("basic save a world", "[save]") {
|
|||
|
||||
Inventory &inv = world.get<Inventory>(player.entity);
|
||||
REQUIRE(inv.gold == 102);
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -24,23 +24,6 @@ TEST_CASE("dumping and debugging", "[map]") {
|
|||
map.dump();
|
||||
}
|
||||
|
||||
|
||||
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("pathing", "[map]") {
|
||||
Map map(20, 20);
|
||||
WorldBuilder builder(map);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue