summaryrefslogtreecommitdiffstats
path: root/tests/Generating/BasicGeneratorTest.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-03 08:57:01 +0200
committerGitHub <noreply@github.com>2020-04-03 08:57:01 +0200
commit01b8ed5295875262a91b60af878bf2a18c1b7aae (patch)
tree52171974791a7529a3a69f9fe20d906158765954 /tests/Generating/BasicGeneratorTest.cpp
parentUpdate Core (diff)
downloadcuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar
cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.gz
cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.bz2
cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.lz
cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.xz
cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.zst
cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.zip
Diffstat (limited to 'tests/Generating/BasicGeneratorTest.cpp')
-rw-r--r--tests/Generating/BasicGeneratorTest.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/tests/Generating/BasicGeneratorTest.cpp b/tests/Generating/BasicGeneratorTest.cpp
index c54ca6507..4b27f5344 100644
--- a/tests/Generating/BasicGeneratorTest.cpp
+++ b/tests/Generating/BasicGeneratorTest.cpp
@@ -175,7 +175,18 @@ static void testGenerateNether(cChunkGenerator & aDefaultNetherGen)
{
TEST_EQUAL_MSG(chd.GetBlockType(x, 0, z), E_BLOCK_BEDROCK, Printf("Bedrock floor at {%d, 0, %d}", x, z));
auto y = chd.GetHeight(x, z);
- TEST_EQUAL(y, prevHeight); // Same height across the entire chunk
+ auto topBlockType = chd.GetBlockType(x, y, z);
+ // Skip the mushrooms generated on the top bedrock layer:
+ if (
+ (topBlockType == E_BLOCK_BROWN_MUSHROOM) ||
+ (topBlockType == E_BLOCK_RED_MUSHROOM)
+ )
+ {
+ y -= 1;
+ }
+ TEST_EQUAL_MSG(y, prevHeight, Printf("Failed: Same height across the entire chunk, at {%d, %d}: exp %d, got %d; top block: %d",
+ x, z, prevHeight, y, chd.GetBlockType(x, y, z)
+ ))
auto blockType = chd.GetBlockType(x, y, z);
TEST_EQUAL_MSG(blockType, E_BLOCK_BEDROCK,
Printf("Bedrock ceiling at {%d, %d, %d}: %d", x, y, z, blockType)
@@ -245,6 +256,11 @@ static void checkChunkChecksums(
{
cChunkDesc chd(coords.mCoords);
aGenerator.Generate(chd);
+ /*
+ cFile f(Printf("Repeatability_%s-%02d-%02d.raw", aDimension, coords.mCoords.m_ChunkX, coords.mCoords.m_ChunkZ), cFile::fmWrite);
+ f.Write(chd.GetBlockTypes(), sizeof(chd.GetBlockTypes()));
+ f.Close();
+ */
auto checksum = chunkSHA1(chd);
TEST_EQUAL_MSG(checksum, coords.mChecksum,
Printf("%s chunk %s SHA1: expected %s, got %s", aDimension, coords.mCoords.ToString(), coords.mChecksum, checksum)
@@ -275,11 +291,11 @@ static void testRepeatability(cChunkGenerator & aDefaultOverworldGenerator, cChu
// Test the default Nether generator:
std::vector<CoordsWithChecksum> netherChecksums =
{
- { 0, 0, "-25231a9ce4bc57eaeaf1f4ad01c32ddd5b2293e5"},
- { 1, 0, "-61ef8824b6b241b4f0e28c09505bad5d7898a8a4"},
- { 1, 1, "6b3ba6dcb18568e21b3a5aae9ea58368079fbaf8"},
- {17, 0, "1acc3a28eb1be66b3e4a256f0712a48f96085a39"},
- { 8, 1024, "6f9b96e0613ca2fd879dbb53634b511e5649627a"},
+ { 0, 0, "-487001a1ada9cdd7c8b557d3ff7081881f57c660"},
+ { 1, 0, "a074ac7a1f2fbf4173324e5edd792197d6a29c2"},
+ { 1, 1, "5867c5121f2a259ebc2aa53ecafed93dd3d6de95"},
+ {17, 0, "-300191cee5b30592f7b61cd22ea08669eba3f569"},
+ { 8, 1024, "69bbda09be981f5e3adc53d0a49995aff43f1290"},
};
checkChunkChecksums(aDefaultNetherGenerator, netherChecksums, "Nether");
}