diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-05-11 16:57:56 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-05-11 16:57:56 +0200 |
commit | 79ab80718ef18f174c73ecb804cb8604e0717fa5 (patch) | |
tree | 4cf0e7884c820037fcad387f78833df188e92fde | |
parent | Fixed a bug in writting zeros to a non-allocated section (diff) | |
download | cuberite-79ab80718ef18f174c73ecb804cb8604e0717fa5.tar cuberite-79ab80718ef18f174c73ecb804cb8604e0717fa5.tar.gz cuberite-79ab80718ef18f174c73ecb804cb8604e0717fa5.tar.bz2 cuberite-79ab80718ef18f174c73ecb804cb8604e0717fa5.tar.lz cuberite-79ab80718ef18f174c73ecb804cb8604e0717fa5.tar.xz cuberite-79ab80718ef18f174c73ecb804cb8604e0717fa5.tar.zst cuberite-79ab80718ef18f174c73ecb804cb8604e0717fa5.zip |
Diffstat (limited to '')
-rw-r--r-- | tests/ChunkBuffer/Copies.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/ChunkBuffer/Copies.cpp b/tests/ChunkBuffer/Copies.cpp index 6bdf80268..a6c83f75d 100644 --- a/tests/ChunkBuffer/Copies.cpp +++ b/tests/ChunkBuffer/Copies.cpp @@ -50,4 +50,40 @@ int main(int argc, char** argv) delete DstNibbleBuffer; SrcNibbleBuffer = NULL; DstNibbleBuffer = NULL; + + SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2]; + for (int i = 0; i < 16 * 16 * 256 / 2; i += 4) + { + SrcNibbleBuffer[i+0] = 0xDE; + SrcNibbleBuffer[i+1] = 0xAD; + SrcNibbleBuffer[i+2] = 0xBE; + SrcNibbleBuffer[i+3] = 0xEF; + } + + 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]; + for (int i = 0; i < 16 * 16 * 256 / 2; i += 4) + { + SrcNibbleBuffer[i+0] = 0xAD; + SrcNibbleBuffer[i+1] = 0xBE; + SrcNibbleBuffer[i+2] = 0xEF; + SrcNibbleBuffer[i+3] = 0xDE; + } + + 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; } |