diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-05-11 19:29:47 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-05-11 19:29:47 +0200 |
commit | a6940445f66948f2dbaa5eaffaa6a89cc15942cb (patch) | |
tree | 5a0cc7f39c404363c0617aefdb378a40dc6e1c82 /tests/ChunkBuffer | |
parent | SkyLight defaults to 0xFF (diff) | |
download | cuberite-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 '')
-rw-r--r-- | tests/ChunkBuffer/Copies.cpp | 45 |
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; } |