mirror of
https://github.com/minetest/minetest.git
synced 2025-07-04 17:00:23 +02:00
Various random code cleanups
This commit is contained in:
@ -80,7 +80,7 @@ void TestRandom::testPseudoRandomRange()
|
||||
s32 min = (pr.next() % 3000) - 500;
|
||||
s32 max = (pr.next() % 3000) - 500;
|
||||
if (min > max)
|
||||
SWAP(s32, min, max);
|
||||
std::swap(min, max);
|
||||
|
||||
s32 randval = pr.range(min, max);
|
||||
UASSERT(randval >= min);
|
||||
@ -120,7 +120,7 @@ void TestRandom::testPcgRandomRange()
|
||||
s32 min = (pr.next() % 3000) - 500;
|
||||
s32 max = (pr.next() % 3000) - 500;
|
||||
if (min > max)
|
||||
SWAP(s32, min, max);
|
||||
std::swap(min, max);
|
||||
|
||||
s32 randval = pr.range(min, max);
|
||||
UASSERT(randval >= min);
|
||||
|
@ -656,8 +656,6 @@ C apply_all(const C &co, F functor)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define cast_v3(T, other) T((other).X, (other).Y, (other).Z)
|
||||
|
||||
void TestUtilities::testIsBlockInSight()
|
||||
{
|
||||
const std::vector<v3s16> testdata1 = {
|
||||
@ -674,7 +672,7 @@ void TestUtilities::testIsBlockInSight()
|
||||
auto test1 = [] (const std::vector<v3s16> &data) {
|
||||
float range = BS * MAP_BLOCKSIZE * 4;
|
||||
float fov = 72 * core::DEGTORAD;
|
||||
v3f cam_pos = cast_v3(v3f, data[0]), cam_dir = cast_v3(v3f, data[1]);
|
||||
v3f cam_pos = v3f::from(data[0]), cam_dir = v3f::from(data[1]);
|
||||
UASSERT( isBlockInSight(data[2], cam_pos, cam_dir, fov, range));
|
||||
UASSERT(!isBlockInSight(data[3], cam_pos, cam_dir, fov, range));
|
||||
UASSERT(!isBlockInSight(data[4], cam_pos, cam_dir, fov, range));
|
||||
|
@ -52,13 +52,11 @@ void TestVoxelManipulator::testVoxelArea()
|
||||
UASSERT(aa.size() == results.size());
|
||||
|
||||
infostream<<"Result of diff:"<<std::endl;
|
||||
for (std::list<VoxelArea>::const_iterator
|
||||
it = aa.begin(); it != aa.end(); ++it) {
|
||||
for (auto it = aa.begin(); it != aa.end(); ++it) {
|
||||
it->print(infostream);
|
||||
infostream << std::endl;
|
||||
|
||||
std::vector<VoxelArea>::iterator j;
|
||||
j = std::find(results.begin(), results.end(), *it);
|
||||
auto j = std::find(results.begin(), results.end(), *it);
|
||||
UASSERT(j != results.end());
|
||||
results.erase(j);
|
||||
}
|
||||
|
Reference in New Issue
Block a user