diff --git a/src/unittest/test_voxelalgorithms.cpp b/src/unittest/test_voxelalgorithms.cpp index 706a6bcce..366755da5 100644 --- a/src/unittest/test_voxelalgorithms.cpp +++ b/src/unittest/test_voxelalgorithms.cpp @@ -50,28 +50,28 @@ void TestVoxelAlgorithms::testVoxelLineIterator() { // Test some lines std::vector> lines; - for (f32 x = -9.1; x < 9; x += 3.124) { - for (f32 y = -9.2; y < 9; y += 3.123) { - for (f32 z = -9.3; z < 9; z += 3.122) { + for (f32 x = -9.1f; x < 9.0f; x += 3.124f) + for (f32 y = -9.2f; y < 9.0f; y += 3.123f) + for (f32 z = -9.3f; z < 9.0f; z += 3.122f) { lines.emplace_back(-x, -y, -z, x, y, z); - }}} - for (f32 x = -3.0; x < 3.1; x += 0.5) { - for (f32 y = -3.0; y < 3.1; y += 0.5) { - for (f32 z = -3.0; z < 3.1; z += 0.5) { + } + for (f32 x = -3.0f; x < 3.1f; x += 0.5f) + for (f32 y = -3.0f; y < 3.1f; y += 0.5f) + for (f32 z = -3.0f; z < 3.1f; z += 0.5f) { lines.emplace_back(-x, -y, -z, x, y, z); - }}} - lines.emplace_back(0, 0, 0, 0, 0, 0); + } + lines.emplace_back(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); // Test every line for (auto l : lines) { // Initialize test voxalgo::VoxelLineIterator iterator(l.start, l.getVector()); //Test the first voxel - v3s16 start_voxel = floatToInt(l.start, 1); + v3s16 start_voxel = floatToInt(l.start, 1.0f); UASSERT(iterator.m_current_node_pos == start_voxel); // Values for testing - v3s16 end_voxel = floatToInt(l.end, 1); + v3s16 end_voxel = floatToInt(l.end, 1.0f); v3s16 voxel_vector = end_voxel - start_voxel; int nodecount = abs(voxel_vector.X) + abs(voxel_vector.Y) + abs(voxel_vector.Z); @@ -86,9 +86,9 @@ void TestVoxelAlgorithms::testVoxelLineIterator() UASSERTEQ(f32, (new_voxel - old_voxel).getLengthSQ(), 1); // The line must intersect with the voxel v3f voxel_center = intToFloat(iterator.m_current_node_pos, 1); - constexpr f32 eps = 1.0e-5; - aabb3f box(voxel_center - v3f(0.5 + eps), - voxel_center + v3f(0.5 + eps)); + constexpr f32 eps = 1.0e-5f; + aabb3f box(voxel_center - v3f(0.5f + eps), + voxel_center + v3f(0.5f + eps)); UASSERT(box.intersectsWithLine(l)); // Update old voxel old_voxel = new_voxel;