// Luanti // SPDX-License-Identifier: LGPL-2.1-or-later // Copyright (C) 2023 Minetest Authors #include "catch.h" #include "dummygamedef.h" #include "map.h" #include "mapsector.h" namespace { class TestMap : public Map { public: TestMap(IGameDef *gamedef) : Map(gamedef) {} MapBlock * createBlockTest(v3s16 p) { v2s16 p2d(p.X, p.Z); s16 block_y = p.Y; MapSector *sector = getSectorNoGenerate(p2d); if (!sector) { sector = new MapSector(this, p2d, m_gamedef); m_sectors[p2d] = sector; } MapBlock *block = sector->getBlockNoCreateNoEx(block_y); if (block) return block; return sector->createBlankBlock(block_y); } }; } static void fillMap(TestMap &map, s16 n) { for(s16 z=0; z0; y--) { v3s16 p(x,y,z); MapBlock *block = map.getBlockNoCreateNoEx(p); if (block) { result++; } } return result; } static int readNodes(Map &map, s16 n) { int result = 0; for(s16 z=0; z