diff options
Diffstat (limited to 'src/unittest/test_voxelmanipulator.cpp')
-rw-r--r-- | src/unittest/test_voxelmanipulator.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/unittest/test_voxelmanipulator.cpp b/src/unittest/test_voxelmanipulator.cpp index c31eb799d..acc2707e7 100644 --- a/src/unittest/test_voxelmanipulator.cpp +++ b/src/unittest/test_voxelmanipulator.cpp @@ -25,8 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "log.h" #include "voxel.h" -class TestVoxelManipulator : public TestBase -{ +class TestVoxelManipulator : public TestBase { public: TestVoxelManipulator() { TestManager::registerTestModule(this); } const char *getName() { return "TestVoxelManipulator"; } @@ -49,26 +48,27 @@ void TestVoxelManipulator::runTests(IGameDef *gamedef) void TestVoxelManipulator::testVoxelArea() { - VoxelArea a(v3s16(-1, -1, -1), v3s16(1, 1, 1)); - UASSERT(a.index(0, 0, 0) == 1 * 3 * 3 + 1 * 3 + 1); - UASSERT(a.index(-1, -1, -1) == 0); + VoxelArea a(v3s16(-1,-1,-1), v3s16(1,1,1)); + UASSERT(a.index(0,0,0) == 1*3*3 + 1*3 + 1); + UASSERT(a.index(-1,-1,-1) == 0); - VoxelArea c(v3s16(-2, -2, -2), v3s16(2, 2, 2)); + VoxelArea c(v3s16(-2,-2,-2), v3s16(2,2,2)); // An area that is 1 bigger in x+ and z- - VoxelArea d(v3s16(-2, -2, -3), v3s16(3, 2, 2)); + VoxelArea d(v3s16(-2,-2,-3), v3s16(3,2,2)); std::list<VoxelArea> aa; d.diff(c, aa); // Correct results std::vector<VoxelArea> results; - results.emplace_back(v3s16(-2, -2, -3), v3s16(3, 2, -3)); - results.emplace_back(v3s16(3, -2, -2), v3s16(3, 2, 2)); + results.emplace_back(v3s16(-2,-2,-3), v3s16(3,2,-3)); + results.emplace_back(v3s16(3,-2,-2), v3s16(3,2,2)); UASSERT(aa.size() == results.size()); - infostream << "Result of diff:" << std::endl; - for (std::list<VoxelArea>::const_iterator it = aa.begin(); it != aa.end(); ++it) { + infostream<<"Result of diff:"<<std::endl; + for (std::list<VoxelArea>::const_iterator + it = aa.begin(); it != aa.end(); ++it) { it->print(infostream); infostream << std::endl; @@ -79,6 +79,7 @@ void TestVoxelManipulator::testVoxelArea() } } + void TestVoxelManipulator::testVoxelManipulator(const NodeDefManager *nodedef) { VoxelManipulator v; @@ -86,22 +87,22 @@ void TestVoxelManipulator::testVoxelManipulator(const NodeDefManager *nodedef) v.print(infostream, nodedef); infostream << "*** Setting (-1,0,-1)=2 ***" << std::endl; - v.setNodeNoRef(v3s16(-1, 0, -1), MapNode(t_CONTENT_GRASS)); + v.setNodeNoRef(v3s16(-1,0,-1), MapNode(t_CONTENT_GRASS)); v.print(infostream, nodedef); - UASSERT(v.getNode(v3s16(-1, 0, -1)).getContent() == t_CONTENT_GRASS); + UASSERT(v.getNode(v3s16(-1,0,-1)).getContent() == t_CONTENT_GRASS); infostream << "*** Reading from inexistent (0,0,-1) ***" << std::endl; - EXCEPTION_CHECK(InvalidPositionException, v.getNode(v3s16(0, 0, -1))); + EXCEPTION_CHECK(InvalidPositionException, v.getNode(v3s16(0,0,-1))); v.print(infostream, nodedef); infostream << "*** Adding area ***" << std::endl; - VoxelArea a(v3s16(-1, -1, -1), v3s16(1, 1, 1)); + VoxelArea a(v3s16(-1,-1,-1), v3s16(1,1,1)); v.addArea(a); v.print(infostream, nodedef); - UASSERT(v.getNode(v3s16(-1, 0, -1)).getContent() == t_CONTENT_GRASS); - EXCEPTION_CHECK(InvalidPositionException, v.getNode(v3s16(0, 1, 1))); + UASSERT(v.getNode(v3s16(-1,0,-1)).getContent() == t_CONTENT_GRASS); + EXCEPTION_CHECK(InvalidPositionException, v.getNode(v3s16(0,1,1))); } |