1
0

Add test for zeros

This commit is contained in:
worktycho 2014-05-17 14:07:49 +01:00
parent 7777da379d
commit d53c84a781

View File

@ -7,6 +7,7 @@
int main(int argc, char** argv)
{
{
// Test first segment
cChunkBuffer buffer;
BLOCKTYPE* SrcBlockBuffer = new BLOCKTYPE[16 * 16 * 256];
@ -43,6 +44,7 @@ int main(int argc, char** argv)
}
{
// test following segment
cChunkBuffer buffer;
BLOCKTYPE* SrcBlockBuffer = new BLOCKTYPE[16 * 16 * 256];
@ -77,5 +79,38 @@ int main(int argc, char** argv)
delete SrcNibbleBuffer;
SrcNibbleBuffer = NULL;
}
{
// test zeros
cChunkBuffer buffer;
BLOCKTYPE* SrcBlockBuffer = new BLOCKTYPE[16 * 16 * 256];
memset(SrcBlockBuffer, 0x00, 16 * 16 * 256);
buffer.SetBlocks(SrcBlockBuffer);
testassert(buffer.GetBlock(7,24,4) == 0x00);
delete SrcBlockBuffer;
SrcBlockBuffer = NULL;
NIBBLETYPE * SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
memset(SrcNibbleBuffer, 0x00, 16 * 16 * 256 /2);
buffer.SetMeta(SrcNibbleBuffer);
testassert(buffer.GetMeta(6,24,1) == 0x0);
delete SrcNibbleBuffer;
SrcNibbleBuffer = NULL;
SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
memset(SrcNibbleBuffer, 0x00, 16 * 16 * 256 /2);
buffer.SetLight(SrcNibbleBuffer);
testassert(buffer.GetBlockLight(6,24,1) == 0x0);
delete SrcNibbleBuffer;
SrcNibbleBuffer = NULL;
SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
memset(SrcNibbleBuffer, 0x00, 16 * 16 * 256 /2);
buffer.SetSkyLight(SrcNibbleBuffer);
testassert(buffer.GetSkyLight(6,24,1) == 0xF);
delete SrcNibbleBuffer;
SrcNibbleBuffer = NULL;
}
}