summaryrefslogtreecommitdiffstats
path: root/tests/ChunkBuffer/Copies.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-05-11 19:29:47 +0200
committerTycho <work.tycho+git@gmail.com>2014-05-11 19:29:47 +0200
commita6940445f66948f2dbaa5eaffaa6a89cc15942cb (patch)
tree5a0cc7f39c404363c0617aefdb378a40dc6e1c82 /tests/ChunkBuffer/Copies.cpp
parentSkyLight defaults to 0xFF (diff)
downloadcuberite-a6940445f66948f2dbaa5eaffaa6a89cc15942cb.tar
cuberite-a6940445f66948f2dbaa5eaffaa6a89cc15942cb.tar.gz
cuberite-a6940445f66948f2dbaa5eaffaa6a89cc15942cb.tar.bz2
cuberite-a6940445f66948f2dbaa5eaffaa6a89cc15942cb.tar.lz
cuberite-a6940445f66948f2dbaa5eaffaa6a89cc15942cb.tar.xz
cuberite-a6940445f66948f2dbaa5eaffaa6a89cc15942cb.tar.zst
cuberite-a6940445f66948f2dbaa5eaffaa6a89cc15942cb.zip
Diffstat (limited to 'tests/ChunkBuffer/Copies.cpp')
-rw-r--r--tests/ChunkBuffer/Copies.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/ChunkBuffer/Copies.cpp b/tests/ChunkBuffer/Copies.cpp
index a6c83f75d..07879d129 100644
--- a/tests/ChunkBuffer/Copies.cpp
+++ b/tests/ChunkBuffer/Copies.cpp
@@ -86,4 +86,49 @@ int main(int argc, char** argv)
delete DstNibbleBuffer;
SrcNibbleBuffer = NULL;
DstNibbleBuffer = NULL;
+
+ SrcBlockBuffer = new BLOCKTYPE[16 * 16 * 256];
+ memset(SrcBlockBuffer, 0x00, 16 * 16 * 256);
+ buffer.SetBlocks(SrcBlockBuffer);
+ DstBlockBuffer = new BLOCKTYPE[16 * 16 * 256];
+ buffer.CopyBlocks(DstBlockBuffer);
+ testassert(memcmp(SrcBlockBuffer, DstBlockBuffer, (16 * 16 * 256) -1) == 0);
+ delete SrcBlockBuffer;
+ delete DstBlockBuffer;
+ SrcBlockBuffer = NULL;
+ DstBlockBuffer = NULL;
+
+ SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
+ for (int i = 0; i < 16 * 16 * 256 / 2; i += 4)
+ memset(SrcNibbleBuffer, 0x00, 16 * 16 * 256 /2);
+ buffer.SetMeta(SrcNibbleBuffer);
+ DstNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/ 2];
+ buffer.CopyMeta(DstNibbleBuffer);
+ testassert(memcmp(SrcNibbleBuffer, DstNibbleBuffer, (16 * 16 * 256 /2) -1) == 0);
+ delete SrcNibbleBuffer;
+ delete DstNibbleBuffer;
+ SrcNibbleBuffer = NULL;
+ DstNibbleBuffer = NULL;
+
+ SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
+ memset(SrcNibbleBuffer, 0x00, 16 * 16 * 256 /2);
+ buffer.SetLight(SrcNibbleBuffer);
+ DstNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/ 2];
+ buffer.CopyLight(DstNibbleBuffer);
+ testassert(memcmp(SrcNibbleBuffer, DstNibbleBuffer, (16 * 16 * 256 /2) -1) == 0);
+ delete SrcNibbleBuffer;
+ delete DstNibbleBuffer;
+ SrcNibbleBuffer = NULL;
+ DstNibbleBuffer = NULL;
+
+ SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
+ memset(SrcNibbleBuffer, 0xFF, 16 * 16 * 256 /2);
+ buffer.SetSkyLight(SrcNibbleBuffer);
+ DstNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/ 2];
+ buffer.CopySkyLight(DstNibbleBuffer);
+ testassert(memcmp(SrcNibbleBuffer, DstNibbleBuffer, (16 * 16 * 256 /2) -1) == 0);
+ delete SrcNibbleBuffer;
+ delete DstNibbleBuffer;
+ SrcNibbleBuffer = NULL;
+ DstNibbleBuffer = NULL;
}