summaryrefslogtreecommitdiffstats
path: root/tests/ChunkBuffer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ChunkBuffer/Copies.cpp87
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;