Tests now run the repair() step.

This commit is contained in:
Zed A. Shaw 2026-03-13 00:36:49 -04:00
parent e6fcbd8dcf
commit a71d6340db
3 changed files with 43 additions and 45 deletions

View file

@ -7,7 +7,7 @@
#include "algos/maze.hpp"
#include "algos/stats.hpp"
#define DUMP 0
#define DUMP 1
using std::string;
using matrix::Matrix;
@ -17,11 +17,15 @@ TEST_CASE("hunt-and-kill", "[mazes]") {
maze::Builder maze(map);
maze.hunt_and_kill();
REQUIRE(maze.repair() == true);
if(DUMP) maze.dump("BASIC MAZE");
maze.randomize_rooms(ROOM_SIZE);
maze.hunt_and_kill();
maze.make_doors();
REQUIRE(maze.repair() == true);
if(DUMP) maze.dump("ROOM MAZE");
REQUIRE(map.$dead_ends.size() > 0);
@ -36,14 +40,15 @@ TEST_CASE("hunt-and-kill box", "[mazes]") {
maze.hunt_and_kill();
maze.clear();
maze.inner_box(6, 4);
maze.randomize_rooms(ROOM_SIZE+2);
maze.randomize_rooms(ROOM_SIZE);
maze.hunt_and_kill();
maze.open_box(6);
maze.make_doors();
auto valid = maze.repair();
if(i == 41 && DUMP) {
maze.dump("INNER BOX");
maze.dump(valid ? "INNER BOX" : "FAILED BOX");
}
}
}
@ -54,6 +59,7 @@ TEST_CASE("hunt-and-kill ring", "[mazes]") {
maze.inner_donut(5.5, 3.5);
maze.hunt_and_kill();
REQUIRE(maze.repair() == true);
if(DUMP) maze.dump("INNER RING");
@ -66,6 +72,7 @@ TEST_CASE("hunt-and-kill fissure", "[mazes]") {
maze.divide({3,3}, {19,18});
maze.hunt_and_kill();
REQUIRE(maze.repair() == true);
if(DUMP) maze.dump("FISSURE MAZE");
@ -78,7 +85,7 @@ TEST_CASE("hunt-and-kill no-dead-ends", "[mazes]") {
maze.hunt_and_kill();
maze.remove_dead_ends();
maze.enclose();
REQUIRE(maze.repair() == true);
if(DUMP) maze.dump("NO DEAD ENDS");
}
@ -95,8 +102,9 @@ TEST_CASE("hunt-and-kill too much", "[mazes]") {
maze.divide({3,3}, {15,16});
maze.hunt_and_kill();
maze.make_doors();
auto valid = maze.repair();
if(i == 41 && DUMP) {
if(i == 41 && DUMP && valid) {
maze.dump("COMBINED");
}
}
@ -120,10 +128,7 @@ TEST_CASE("hunt-and-kill validator", "[mazes]") {
maze.hunt_and_kill();
maze.open_box(6);
maze.make_doors();
maze.enclose();
valid = maze.validate();
if(!valid) valid = maze.repair();
valid = maze.repair();
if(i == 9) {
if(valid) {
@ -132,7 +137,6 @@ TEST_CASE("hunt-and-kill validator", "[mazes]") {
matrix::dump("PATHING", maze.$paths.$paths);
}
}
door_prob.sample(valid);
} while(!valid);