Iterators are now working far more reliably and have more extensive tests that randomize inputs and fuzz them to check they keep working.
This commit is contained in:
parent
8e470df554
commit
70cd963e5c
11 changed files with 318 additions and 84 deletions
|
@ -10,25 +10,27 @@ using namespace nlohmann;
|
|||
using std::string;
|
||||
|
||||
TEST_CASE("bsp algo test", "[builder]") {
|
||||
Map map(20, 20);
|
||||
Map map(31, 20);
|
||||
WorldBuilder builder(map);
|
||||
builder.generate();
|
||||
}
|
||||
|
||||
TEST_CASE("dumping and debugging", "[builder]") {
|
||||
Map map(20, 20);
|
||||
WorldBuilder builder(map);
|
||||
builder.generate();
|
||||
|
||||
matrix::dump("GENERATED", map.paths());
|
||||
map.dump();
|
||||
}
|
||||
|
||||
TEST_CASE("pathing", "[builder]") {
|
||||
Map map(20, 20);
|
||||
Map map(23, 14);
|
||||
WorldBuilder builder(map);
|
||||
builder.generate();
|
||||
|
||||
REQUIRE(map.can_move({0,0}) == false);
|
||||
REQUIRE(map.iswall(0,0) == true);
|
||||
matrix::dump("WALLS", map.$walls, 0,0);
|
||||
println("wall at 0,0=={}", map.$walls[0][0]);
|
||||
|
||||
|
||||
for(matrix::each_cell it{map.$walls}; it.next();) {
|
||||
if(map.$walls[it.y][it.x] == WALL_VALUE) {
|
||||
REQUIRE(map.iswall(it.x, it.y) == true);
|
||||
REQUIRE(map.can_move({it.x, it.y}) == false);
|
||||
} else {
|
||||
REQUIRE(map.iswall(it.x, it.y) == false);
|
||||
REQUIRE(map.can_move({it.x, it.y}) == true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue