|
|
|
@ -36,6 +36,58 @@ TEST_CASE("dijkstra algo test", "[map]") { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_CASE("bsp algo test", "[map]") { |
|
|
|
|
Map map(50, 20); |
|
|
|
|
Map map(20, 20); |
|
|
|
|
map.generate(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_CASE("dumping and debugging", "[map]") { |
|
|
|
|
Map map(20, 20); |
|
|
|
|
map.generate(); |
|
|
|
|
|
|
|
|
|
dump_map("GENERATED", map.paths()); |
|
|
|
|
map.dump(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_CASE("lighting test", "[map]") { |
|
|
|
|
Map map(20,20); |
|
|
|
|
map.generate(); |
|
|
|
|
Point light1 = map.place_entity(0); |
|
|
|
|
Point light2 = map.place_entity(1); |
|
|
|
|
LightSource source1{7,1}; |
|
|
|
|
LightSource source2{3,2}; |
|
|
|
|
|
|
|
|
|
map.reset_light(); |
|
|
|
|
|
|
|
|
|
map.set_light_target(light1); |
|
|
|
|
map.set_light_target(light2); |
|
|
|
|
|
|
|
|
|
map.path_light(); |
|
|
|
|
|
|
|
|
|
map.render_light(source1, light1); |
|
|
|
|
map.render_light(source2, light2); |
|
|
|
|
|
|
|
|
|
map.clear_light_target(light1); |
|
|
|
|
map.clear_light_target(light2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_CASE("camera control", "[map]") { |
|
|
|
|
Map map(20,20); |
|
|
|
|
map.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); |
|
|
|
|
map.generate(); |
|
|
|
|
REQUIRE(map.can_move({0,0}) == false); |
|
|
|
|
REQUIRE(map.iswall(0,0) == true); |
|
|
|
|
} |
|
|
|
|