summaryrefslogtreecommitdiffstats
path: root/tests/ChunkData/Coordinates.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-04-23 09:22:25 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-04-23 09:22:25 +0200
commit611cb8cb4e17c55b1dc913837268bf9dd423df75 (patch)
tree1d4f49943813a5309ef081ae8f9e696a388ba8a4 /tests/ChunkData/Coordinates.cpp
parentUpdated readme to inform that clang 3.4 is minimum required version. (#3158) (diff)
parentOut of world blocks are now always considered air blocks (diff)
downloadcuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar.gz
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar.bz2
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar.lz
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar.xz
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar.zst
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.zip
Diffstat (limited to 'tests/ChunkData/Coordinates.cpp')
-rw-r--r--tests/ChunkData/Coordinates.cpp71
1 files changed, 23 insertions, 48 deletions
diff --git a/tests/ChunkData/Coordinates.cpp b/tests/ChunkData/Coordinates.cpp
index de6686243..1aabb5374 100644
--- a/tests/ChunkData/Coordinates.cpp
+++ b/tests/ChunkData/Coordinates.cpp
@@ -13,7 +13,7 @@ int main(int argc, char** argv)
{
return new cChunkData::sChunkSection();
}
-
+
virtual void Free(cChunkData::sChunkSection * a_Ptr)
{
delete a_Ptr;
@@ -36,7 +36,7 @@ int main(int argc, char** argv)
testassert(buffer.GetBlock(0, 32, 0) == 0x0);
testassert(buffer.GetMeta(0, 48, 0) == 0x0);
- // Out of Range
+ // Out of range SetBlock
CheckAsserts(
buffer.SetBlock(-1, 0, 0, 0);
);
@@ -55,28 +55,7 @@ int main(int argc, char** argv)
CheckAsserts(
buffer.SetBlock(0, 0, 256, 0);
);
-
- // Out of Range
- CheckAsserts(
- buffer.GetBlock(-1, 0, 0);
- );
- CheckAsserts(
- buffer.GetBlock(0, -1, 0);
- );
- CheckAsserts(
- buffer.GetBlock(0, 0, -1);
- );
- CheckAsserts(
- buffer.GetBlock(256, 0, 0);
- );
- CheckAsserts(
- buffer.GetBlock(0, 256, 0);
- );
- CheckAsserts(
- buffer.GetBlock(0, 0, 256);
- );
-
- // Out of Range
+ // Out of range SetMeta
CheckAsserts(
buffer.SetMeta(-1, 0, 0, 0);
);
@@ -96,30 +75,26 @@ int main(int argc, char** argv)
buffer.SetMeta(0, 0, 256, 0);
);
- // Out of Range
- CheckAsserts(
- buffer.GetMeta(-1, 0, 0);
- );
- CheckAsserts(
- buffer.GetMeta(0, -1, 0);
- );
- CheckAsserts(
- buffer.GetMeta(0, 0, -1);
- );
- CheckAsserts(
- buffer.GetMeta(256, 0, 0);
- );
- CheckAsserts(
- buffer.GetMeta(0, 256, 0);
- );
- CheckAsserts(
- buffer.GetMeta(0, 0, 256);
- );
+ // Reading out of range blocks should return air
+ testassert(buffer.GetBlock(-1, 0, 0) == 0);
+ testassert(buffer.GetBlock(0, -1, 0) == 0);
+ testassert(buffer.GetBlock(0, 0, -1) == 0);
+ testassert(buffer.GetBlock(256, 0, 0) == 0);
+ testassert(buffer.GetBlock(0, 256, 0) == 0);
+ testassert(buffer.GetBlock(0, 0, 256) == 0);
+
+ // Reading out of range metas should return 0
+ testassert(buffer.GetMeta(-1, 0, 0) == 0);
+ testassert(buffer.GetMeta(0, -1, 0) == 0);
+ testassert(buffer.GetMeta(0, 0, -1) == 0);
+ testassert(buffer.GetMeta(256, 0, 0) == 0);
+ testassert(buffer.GetMeta(0, 256, 0) == 0);
+ testassert(buffer.GetMeta(0, 0, 256) == 0);
}
-
+
{
cChunkData buffer(Pool);
-
+
// Zero's
buffer.SetBlock(0, 0, 0, 0x0);
buffer.SetBlock(0, 0, 1, 0xab);
@@ -131,8 +106,8 @@ int main(int argc, char** argv)
testassert(buffer.GetMeta(0, 16, 0) == 0x0);
testassert(buffer.GetMeta(0, 16, 1) == 0xc);
}
-
-
+
+
{
// Operator =
cChunkData buffer(Pool);
@@ -141,6 +116,6 @@ int main(int argc, char** argv)
copy = std::move(buffer);
testassert(copy.GetBlock(0, 0, 0) == 0x42);
}
-
+
return 0;
}