diff options
author | worktycho <work.tycho@gmail.com> | 2014-05-17 14:39:28 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2014-05-17 14:39:28 +0200 |
commit | 710656f84f7a572ff92a302548b19d1705c66851 (patch) | |
tree | cd3156d2b047617f27ad4e1cdc55eb5b9e0b616b | |
parent | excluding tests excludes everything (diff) | |
download | cuberite-710656f84f7a572ff92a302548b19d1705c66851.tar cuberite-710656f84f7a572ff92a302548b19d1705c66851.tar.gz cuberite-710656f84f7a572ff92a302548b19d1705c66851.tar.bz2 cuberite-710656f84f7a572ff92a302548b19d1705c66851.tar.lz cuberite-710656f84f7a572ff92a302548b19d1705c66851.tar.xz cuberite-710656f84f7a572ff92a302548b19d1705c66851.tar.zst cuberite-710656f84f7a572ff92a302548b19d1705c66851.zip |
Diffstat (limited to '')
-rw-r--r-- | tests/ChunkBuffer/Copies.cpp | 87 |
1 files changed, 51 insertions, 36 deletions
diff --git a/tests/ChunkBuffer/Copies.cpp b/tests/ChunkBuffer/Copies.cpp index b37414ce4..76af81496 100644 --- a/tests/ChunkBuffer/Copies.cpp +++ b/tests/ChunkBuffer/Copies.cpp @@ -33,6 +33,21 @@ int main(int argc, char** argv) delete DstBlockBuffer; SrcBlockBuffer = NULL; DstBlockBuffer = 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; + + } + { + cChunkBuffer buffer; NIBBLETYPE * SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2]; for (int i = 0; i < 16 * 16 * 256 / 2; i += 4) @@ -51,8 +66,23 @@ int main(int argc, char** argv) delete DstNibbleBuffer; SrcNibbleBuffer = NULL; DstNibbleBuffer = NULL; - + SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2]; + 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; + + } + { + cChunkBuffer buffer; + + NIBBLETYPE * SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2]; for (int i = 0; i < 16 * 16 * 256 / 2; i += 4) { SrcNibbleBuffer[i+0] = 0xDE; @@ -62,6 +92,17 @@ int main(int argc, char** argv) } buffer.SetLight(SrcNibbleBuffer); + NIBBLETYPE * 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, 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); @@ -70,7 +111,12 @@ int main(int argc, char** argv) SrcNibbleBuffer = NULL; DstNibbleBuffer = NULL; - SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2]; + + } + { + cChunkBuffer buffer; + + NIBBLETYPE * SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2]; for (int i = 0; i < 16 * 16 * 256 / 2; i += 4) { SrcNibbleBuffer[i+0] = 0xAD; @@ -80,7 +126,7 @@ int main(int argc, char** argv) } buffer.SetSkyLight(SrcNibbleBuffer); - DstNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/ 2]; + NIBBLETYPE * DstNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/ 2]; buffer.CopySkyLight(DstNibbleBuffer); testassert(memcmp(SrcNibbleBuffer, DstNibbleBuffer, (16 * 16 * 256 /2) -1) == 0); delete SrcNibbleBuffer; @@ -88,39 +134,7 @@ int main(int argc, char** argv) 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]; - 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); @@ -131,6 +145,7 @@ int main(int argc, char** argv) delete DstNibbleBuffer; SrcNibbleBuffer = NULL; DstNibbleBuffer = NULL; + } { cChunkBuffer buffer; |