summaryrefslogtreecommitdiffstats
path: root/tests/ChunkData
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-06-16 16:00:14 +0200
committerMattes D <github@xoft.cz>2014-06-16 16:00:14 +0200
commit24b0878af753c0873f71c738be0c1ac94f6c062b (patch)
tree01275c7080eb2cc3c821a2a398f8f2d2f78ff47c /tests/ChunkData
parentFixed a copypasta error in WormNestCaves generator settings. (diff)
parentAdded override (diff)
downloadcuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar
cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar.gz
cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar.bz2
cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar.lz
cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar.xz
cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar.zst
cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.zip
Diffstat (limited to 'tests/ChunkData')
-rw-r--r--tests/ChunkData/ArraytoCoord.cpp20
-rw-r--r--tests/ChunkData/Coordinates.cpp21
-rw-r--r--tests/ChunkData/Copies.cpp23
-rw-r--r--tests/ChunkData/CopyBlocks.cpp15
-rw-r--r--tests/ChunkData/creatable.cpp15
5 files changed, 80 insertions, 14 deletions
diff --git a/tests/ChunkData/ArraytoCoord.cpp b/tests/ChunkData/ArraytoCoord.cpp
index 0daf38f7b..9d0ca6c8c 100644
--- a/tests/ChunkData/ArraytoCoord.cpp
+++ b/tests/ChunkData/ArraytoCoord.cpp
@@ -6,9 +6,23 @@
int main(int argc, char** argv)
{
+ class cMockAllocationPool
+ : public cAllocationPool<cChunkData::sChunkSection>
+ {
+ virtual cChunkData::sChunkSection * Allocate()
+ {
+ return new cChunkData::sChunkSection();
+ }
+
+ virtual void Free(cChunkData::sChunkSection * a_Ptr)
+ {
+ delete a_Ptr;
+ }
+ } Pool;
{
+
// Test first segment
- cChunkData buffer;
+ cChunkData buffer(Pool);
BLOCKTYPE SrcBlockBuffer[16 * 16 * 256];
memset(SrcBlockBuffer, 0x00, sizeof(SrcBlockBuffer));
@@ -35,7 +49,7 @@ int main(int argc, char** argv)
{
// test following segment
- cChunkData buffer;
+ cChunkData buffer(Pool);
BLOCKTYPE SrcBlockBuffer[16 * 16 * 256];
memset(SrcBlockBuffer, 0x00, sizeof(SrcBlockBuffer));
@@ -62,7 +76,7 @@ int main(int argc, char** argv)
{
// test zeros
- cChunkData buffer;
+ cChunkData buffer(Pool);
BLOCKTYPE SrcBlockBuffer[16 * 16 * 256];
memset(SrcBlockBuffer, 0x00, sizeof(SrcBlockBuffer));
diff --git a/tests/ChunkData/Coordinates.cpp b/tests/ChunkData/Coordinates.cpp
index 48d731c7e..b3c66dde5 100644
--- a/tests/ChunkData/Coordinates.cpp
+++ b/tests/ChunkData/Coordinates.cpp
@@ -6,8 +6,21 @@
int main(int argc, char** argv)
{
+ class cMockAllocationPool
+ : public cAllocationPool<cChunkData::sChunkSection>
+ {
+ virtual cChunkData::sChunkSection * Allocate()
+ {
+ return new cChunkData::sChunkSection();
+ }
+
+ virtual void Free(cChunkData::sChunkSection * a_Ptr)
+ {
+ delete a_Ptr;
+ }
+ } Pool;
{
- cChunkData buffer;
+ cChunkData buffer(Pool);
// Empty chunks
buffer.SetBlock(0, 0, 0, 0xAB);
@@ -105,7 +118,7 @@ int main(int argc, char** argv)
}
{
- cChunkData buffer;
+ cChunkData buffer(Pool);
// Zero's
buffer.SetBlock(0, 0, 0, 0x0);
@@ -122,9 +135,9 @@ int main(int argc, char** argv)
{
// Operator =
- cChunkData buffer;
+ cChunkData buffer(Pool);
buffer.SetBlock(0, 0, 0, 0x42);
- cChunkData copy;
+ cChunkData copy(Pool);
#if __cplusplus < 201103L
copy = buffer;
#else
diff --git a/tests/ChunkData/Copies.cpp b/tests/ChunkData/Copies.cpp
index 312441eee..440819e91 100644
--- a/tests/ChunkData/Copies.cpp
+++ b/tests/ChunkData/Copies.cpp
@@ -6,8 +6,21 @@
int main(int argc, char** argv)
{
+ class cMockAllocationPool
+ : public cAllocationPool<cChunkData::sChunkSection>
+ {
+ virtual cChunkData::sChunkSection * Allocate()
+ {
+ return new cChunkData::sChunkSection();
+ }
+
+ virtual void Free(cChunkData::sChunkSection * a_Ptr)
+ {
+ delete a_Ptr;
+ }
+ } Pool;
{
- cChunkData buffer;
+ cChunkData buffer(Pool);
buffer.SetBlock(3, 1, 4, 0xDE);
buffer.SetMeta(3, 1, 4, 0xA);
@@ -37,7 +50,7 @@ int main(int argc, char** argv)
}
{
- cChunkData buffer;
+ cChunkData buffer(Pool);
NIBBLETYPE SrcNibbleBuffer[16 * 16 * 256 / 2];
for (int i = 0; i < 16 * 16 * 256 / 2; i += 4)
@@ -60,7 +73,7 @@ int main(int argc, char** argv)
}
{
- cChunkData buffer;
+ cChunkData buffer(Pool);
NIBBLETYPE SrcNibbleBuffer[16 * 16 * 256 / 2];
for (int i = 0; i < 16 * 16 * 256 / 2; i += 4)
@@ -83,7 +96,7 @@ int main(int argc, char** argv)
}
{
- cChunkData buffer;
+ cChunkData buffer(Pool);
NIBBLETYPE SrcNibbleBuffer[16 * 16 * 256 / 2];
for (int i = 0; i < 16 * 16 * 256 / 2; i += 4)
@@ -106,7 +119,7 @@ int main(int argc, char** argv)
}
{
- cChunkData buffer;
+ cChunkData buffer(Pool);
BLOCKTYPE SrcBlockBuffer[16 * 16 * 256];
memset(SrcBlockBuffer, 0x00, 16 * 16 * 256);
diff --git a/tests/ChunkData/CopyBlocks.cpp b/tests/ChunkData/CopyBlocks.cpp
index be8cab234..ec9451099 100644
--- a/tests/ChunkData/CopyBlocks.cpp
+++ b/tests/ChunkData/CopyBlocks.cpp
@@ -17,7 +17,20 @@
int main(int argc, char ** argv)
{
// Set up a cChunkData with known contents - all blocks 0x01, all metas 0x02:
- cChunkData Data;
+ class cMockAllocationPool
+ : public cAllocationPool<cChunkData::sChunkSection>
+ {
+ virtual cChunkData::sChunkSection * Allocate()
+ {
+ return new cChunkData::sChunkSection();
+ }
+
+ virtual void Free(cChunkData::sChunkSection * a_Ptr)
+ {
+ delete a_Ptr;
+ }
+ } Pool;
+ cChunkData Data(Pool);
cChunkDef::BlockTypes BlockTypes;
cChunkDef::BlockNibbles BlockMetas;
memset(BlockTypes, 0x01, sizeof(BlockTypes));
diff --git a/tests/ChunkData/creatable.cpp b/tests/ChunkData/creatable.cpp
index 1321bf49b..fc786f688 100644
--- a/tests/ChunkData/creatable.cpp
+++ b/tests/ChunkData/creatable.cpp
@@ -4,6 +4,19 @@
int main(int argc, char** argv)
{
- cChunkData buffer;
+ class cMockAllocationPool
+ : public cAllocationPool<cChunkData::sChunkSection>
+ {
+ virtual cChunkData::sChunkSection * Allocate()
+ {
+ return new cChunkData::sChunkSection();
+ }
+
+ virtual void Free(cChunkData::sChunkSection * a_Ptr)
+ {
+ delete a_Ptr;
+ }
+ } Pool;
+ cChunkData buffer(Pool);
return 0;
}