summaryrefslogtreecommitdiffstats
path: root/tests/ChunkBuffer
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2014-05-17 15:07:49 +0200
committerworktycho <work.tycho@gmail.com>2014-05-17 15:07:49 +0200
commitd53c84a7811e7f7af144efe24fdc21fa7b07f6ce (patch)
tree40c339178bdb20f4c9a7dca67b7c92494e22952c /tests/ChunkBuffer
parentFix assignment operators (diff)
downloadcuberite-d53c84a7811e7f7af144efe24fdc21fa7b07f6ce.tar
cuberite-d53c84a7811e7f7af144efe24fdc21fa7b07f6ce.tar.gz
cuberite-d53c84a7811e7f7af144efe24fdc21fa7b07f6ce.tar.bz2
cuberite-d53c84a7811e7f7af144efe24fdc21fa7b07f6ce.tar.lz
cuberite-d53c84a7811e7f7af144efe24fdc21fa7b07f6ce.tar.xz
cuberite-d53c84a7811e7f7af144efe24fdc21fa7b07f6ce.tar.zst
cuberite-d53c84a7811e7f7af144efe24fdc21fa7b07f6ce.zip
Diffstat (limited to 'tests/ChunkBuffer')
-rw-r--r--tests/ChunkBuffer/ArraytoCoord.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/ChunkBuffer/ArraytoCoord.cpp b/tests/ChunkBuffer/ArraytoCoord.cpp
index a765c5302..993dc6cc5 100644
--- a/tests/ChunkBuffer/ArraytoCoord.cpp
+++ b/tests/ChunkBuffer/ArraytoCoord.cpp
@@ -7,6 +7,7 @@
int main(int argc, char** argv)
{
{
+ // Test first segment
cChunkBuffer buffer;
BLOCKTYPE* SrcBlockBuffer = new BLOCKTYPE[16 * 16 * 256];
@@ -43,6 +44,7 @@ int main(int argc, char** argv)
}
{
+ // test following segment
cChunkBuffer buffer;
BLOCKTYPE* SrcBlockBuffer = new BLOCKTYPE[16 * 16 * 256];
@@ -77,5 +79,38 @@ int main(int argc, char** argv)
delete SrcNibbleBuffer;
SrcNibbleBuffer = NULL;
}
+
+ {
+ // test zeros
+ cChunkBuffer buffer;
+
+ BLOCKTYPE* SrcBlockBuffer = new BLOCKTYPE[16 * 16 * 256];
+ memset(SrcBlockBuffer, 0x00, 16 * 16 * 256);
+ buffer.SetBlocks(SrcBlockBuffer);
+ testassert(buffer.GetBlock(7,24,4) == 0x00);
+ delete SrcBlockBuffer;
+ SrcBlockBuffer = NULL;
+
+ NIBBLETYPE * SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
+ memset(SrcNibbleBuffer, 0x00, 16 * 16 * 256 /2);
+ buffer.SetMeta(SrcNibbleBuffer);
+ testassert(buffer.GetMeta(6,24,1) == 0x0);
+ delete SrcNibbleBuffer;
+ SrcNibbleBuffer = NULL;
+
+ SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
+ memset(SrcNibbleBuffer, 0x00, 16 * 16 * 256 /2);
+ buffer.SetLight(SrcNibbleBuffer);
+ testassert(buffer.GetBlockLight(6,24,1) == 0x0);
+ delete SrcNibbleBuffer;
+ SrcNibbleBuffer = NULL;
+
+ SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
+ memset(SrcNibbleBuffer, 0x00, 16 * 16 * 256 /2);
+ buffer.SetSkyLight(SrcNibbleBuffer);
+ testassert(buffer.GetSkyLight(6,24,1) == 0xF);
+ delete SrcNibbleBuffer;
+ SrcNibbleBuffer = NULL;
+ }
}