test: cover testNetherGen
This commit is contained in:
1 parent
e6bf531927
commit
e215d7190b
1 file changed
+148
@@ -164,3 +164,151 @@ VF_TEST(netherLavaSeaLeavesNoAirBelowItsSurface) {
|
|||||||
CHECK(lavaSamples > 0);
|
CHECK(lavaSamples > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VF_TEST(netherCarriesAllFourBiomes) {
|
||||||
|
NetherGenerator generator;
|
||||||
|
std::set<int> seen;
|
||||||
|
for (int gx = -900; gx <= 900; gx += 17)
|
||||||
|
for (int gz = -900; gz <= 900; gz += 17)
|
||||||
|
seen.insert(static_cast<int>(generator.biomeAt(gx, gz)));
|
||||||
|
CHECK_EQ(seen.size(), static_cast<std::size_t>(NetherBiome::Count));
|
||||||
|
}
|
||||||
|
|
||||||
|
VF_TEST(netherBiomesLayDownTheirOwnSurfaceBlocks) {
|
||||||
|
NetherGenerator generator;
|
||||||
|
int soulSandTops = 0;
|
||||||
|
int basaltTops = 0;
|
||||||
|
int mossTops = 0;
|
||||||
|
int foreignSoulTops = 0;
|
||||||
|
|
||||||
|
for (int gx = -600; gx <= 600; gx += 13) {
|
||||||
|
for (int gz = -600; gz <= 600; gz += 13) {
|
||||||
|
NetherColumn column = generator.columnAt(gx, gz);
|
||||||
|
Block top = generator.blockAt(column, gx, column.floorHeight, gz);
|
||||||
|
switch (column.biome) {
|
||||||
|
case NetherBiome::SoulSandValley:
|
||||||
|
if (top == Block::SoulSand) ++soulSandTops;
|
||||||
|
if (top == Block::Basalt || top == Block::Moss) ++foreignSoulTops;
|
||||||
|
break;
|
||||||
|
case NetherBiome::BasaltDeltas:
|
||||||
|
if (top == Block::Basalt) ++basaltTops;
|
||||||
|
break;
|
||||||
|
case NetherBiome::CrimsonForest:
|
||||||
|
if (top == Block::Moss) ++mossTops;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CHECK(soulSandTops > 0);
|
||||||
|
CHECK(basaltTops > 0);
|
||||||
|
CHECK(mossTops > 0);
|
||||||
|
CHECK_EQ(foreignSoulTops, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
VF_TEST(netherSoulSandValleyFillsItselfWithSoulSoil) {
|
||||||
|
NetherGenerator generator;
|
||||||
|
int columnX = 0, columnZ = 0;
|
||||||
|
CHECK(findColumnWithBiome(generator, NetherBiome::SoulSandValley, columnX, columnZ) == 1);
|
||||||
|
|
||||||
|
World world;
|
||||||
|
generator.generateColumn(world, columnX, columnZ);
|
||||||
|
std::map<Block, int> tally = censusColumn(world, columnX, columnZ, generator.settings().ceilingY);
|
||||||
|
|
||||||
|
CHECK(countOf(tally, Block::SoulSand) > 0);
|
||||||
|
CHECK(countOf(tally, Block::SoulSoil) > 0);
|
||||||
|
CHECK_EQ(countOf(tally, Block::Basalt), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
VF_TEST(netherStocksQuartzGlowstoneAndLava) {
|
||||||
|
NetherGenerator generator;
|
||||||
|
World world;
|
||||||
|
for (int columnX = -2; columnX <= 2; ++columnX)
|
||||||
|
for (int columnZ = -2; columnZ <= 2; ++columnZ)
|
||||||
|
generator.generateColumn(world, columnX, columnZ);
|
||||||
|
|
||||||
|
int quartz = 0, glowstone = 0, lava = 0, netherrack = 0, magma = 0;
|
||||||
|
for (int gx = -32; gx < 48; ++gx) {
|
||||||
|
for (int gz = -32; gz < 48; ++gz) {
|
||||||
|
for (int gy = 0; gy < generator.settings().ceilingY; ++gy) {
|
||||||
|
switch (world.blockAt(gx, gy, gz)) {
|
||||||
|
case Block::NetherQuartzOre: ++quartz; break;
|
||||||
|
case Block::Glowstone: ++glowstone; break;
|
||||||
|
case Block::Lava: ++lava; break;
|
||||||
|
case Block::Netherrack: ++netherrack; break;
|
||||||
|
case Block::Magma: ++magma; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CHECK(quartz > 0);
|
||||||
|
CHECK(glowstone > 0);
|
||||||
|
CHECK(magma > 0);
|
||||||
|
CHECK(lava > 1000);
|
||||||
|
CHECK(netherrack > quartz);
|
||||||
|
}
|
||||||
|
|
||||||
|
VF_TEST(netherGlowstoneClingsToTheRoofNotTheFloor) {
|
||||||
|
NetherGenerator generator;
|
||||||
|
World world;
|
||||||
|
for (int columnX = -1; columnX <= 1; ++columnX)
|
||||||
|
for (int columnZ = -1; columnZ <= 1; ++columnZ)
|
||||||
|
generator.generateColumn(world, columnX, columnZ);
|
||||||
|
|
||||||
|
int lowGlowstone = 0;
|
||||||
|
int highGlowstone = 0;
|
||||||
|
for (int gx = -16; gx < 32; ++gx) {
|
||||||
|
for (int gz = -16; gz < 32; ++gz) {
|
||||||
|
NetherColumn column = generator.columnAt(gx, gz);
|
||||||
|
for (int gy = 0; gy < generator.settings().ceilingY; ++gy) {
|
||||||
|
if (world.blockAt(gx, gy, gz) != Block::Glowstone) continue;
|
||||||
|
if (gy >= column.ceilingHeight - 4) ++highGlowstone;
|
||||||
|
else ++lowGlowstone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CHECK(highGlowstone > 0);
|
||||||
|
CHECK_EQ(lowGlowstone, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
VF_TEST(netherCavesCarveRockWithoutEmptyingIt) {
|
||||||
|
NetherGenerator generator;
|
||||||
|
int carved = 0;
|
||||||
|
int total = 0;
|
||||||
|
for (int gx = -200; gx <= 200; gx += 7) {
|
||||||
|
for (int gz = -200; gz <= 200; gz += 7) {
|
||||||
|
for (int gy = 8; gy < 120; gy += 9) {
|
||||||
|
if (generator.isCarved(gx, gy, gz)) ++carved;
|
||||||
|
++total;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CHECK(carved > 0);
|
||||||
|
CHECK(carved < total / 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
VF_TEST(netherDecorationCanBeSwitchedOffWithoutChangingTheRock) {
|
||||||
|
NetherGenerator::Params bare;
|
||||||
|
bare.decorate = false;
|
||||||
|
NetherGenerator plain(bare);
|
||||||
|
NetherGenerator decorated;
|
||||||
|
|
||||||
|
World plainWorld, decoratedWorld;
|
||||||
|
plain.generateColumn(plainWorld, 1, 1);
|
||||||
|
decorated.generateColumn(decoratedWorld, 1, 1);
|
||||||
|
|
||||||
|
int differences = 0;
|
||||||
|
int netherrackKept = 0;
|
||||||
|
for (int gx = 16; gx < 32; ++gx) {
|
||||||
|
for (int gz = 16; gz < 32; ++gz) {
|
||||||
|
for (int gy = 0; gy < 128; ++gy) {
|
||||||
|
Block bareBlock = plainWorld.blockAt(gx, gy, gz);
|
||||||
|
if (bareBlock != decoratedWorld.blockAt(gx, gy, gz)) ++differences;
|
||||||
|
else if (bareBlock == Block::Netherrack) ++netherrackKept;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CHECK(differences > 0);
|
||||||
|
CHECK(netherrackKept > 1000);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user