summaryrefslogtreecommitdiffstats
path: root/tests/ChunkData
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ChunkData/ArraytoCoord.cpp21
-rw-r--r--tests/ChunkData/Coordinates.cpp19
-rw-r--r--tests/ChunkData/Copies.cpp21
-rw-r--r--tests/ChunkData/CopyBlocks.cpp21
-rw-r--r--tests/ChunkData/creatable.cpp21
5 files changed, 64 insertions, 39 deletions
diff --git a/tests/ChunkData/ArraytoCoord.cpp b/tests/ChunkData/ArraytoCoord.cpp
index 3f22d239a..9d0ca6c8c 100644
--- a/tests/ChunkData/ArraytoCoord.cpp
+++ b/tests/ChunkData/ArraytoCoord.cpp
@@ -6,14 +6,19 @@
int main(int argc, char** argv)
{
- class cStarvationCallbacks
- : public cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks
- {
- virtual void OnStartingUsingBuffer() {}
- virtual void OnStopUsingBuffer() {}
- virtual void OnBufferEmpty() {}
- };
- cAllocationPool<cChunkData::sChunkSection, 1600> Pool(std::auto_ptr<cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks>(new cStarvationCallbacks()));
+ 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
diff --git a/tests/ChunkData/Coordinates.cpp b/tests/ChunkData/Coordinates.cpp
index 1ac600f82..b3c66dde5 100644
--- a/tests/ChunkData/Coordinates.cpp
+++ b/tests/ChunkData/Coordinates.cpp
@@ -6,14 +6,19 @@
int main(int argc, char** argv)
{
- class cStarvationCallbacks
- : public cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks
+ class cMockAllocationPool
+ : public cAllocationPool<cChunkData::sChunkSection>
{
- virtual void OnStartingUsingBuffer() {}
- virtual void OnStopUsingBuffer() {}
- virtual void OnBufferEmpty() {}
- };
- cAllocationPool<cChunkData::sChunkSection, 1600> Pool(std::auto_ptr<cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks>(new cStarvationCallbacks()));
+ virtual cChunkData::sChunkSection * Allocate()
+ {
+ return new cChunkData::sChunkSection();
+ }
+
+ virtual void Free(cChunkData::sChunkSection * a_Ptr)
+ {
+ delete a_Ptr;
+ }
+ } Pool;
{
cChunkData buffer(Pool);
diff --git a/tests/ChunkData/Copies.cpp b/tests/ChunkData/Copies.cpp
index 4a672380f..440819e91 100644
--- a/tests/ChunkData/Copies.cpp
+++ b/tests/ChunkData/Copies.cpp
@@ -6,14 +6,19 @@
int main(int argc, char** argv)
{
- class cStarvationCallbacks
- : public cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks
- {
- virtual void OnStartingUsingBuffer() {}
- virtual void OnStopUsingBuffer() {}
- virtual void OnBufferEmpty() {}
- };
- cAllocationPool<cChunkData::sChunkSection, 1600> Pool(std::auto_ptr<cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks>(new cStarvationCallbacks()));
+ 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);
diff --git a/tests/ChunkData/CopyBlocks.cpp b/tests/ChunkData/CopyBlocks.cpp
index db3d391c3..ec9451099 100644
--- a/tests/ChunkData/CopyBlocks.cpp
+++ b/tests/ChunkData/CopyBlocks.cpp
@@ -17,14 +17,19 @@
int main(int argc, char ** argv)
{
// Set up a cChunkData with known contents - all blocks 0x01, all metas 0x02:
- class cStarvationCallbacks
- : public cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks
- {
- virtual void OnStartingUsingBuffer() {}
- virtual void OnStopUsingBuffer() {}
- virtual void OnBufferEmpty() {}
- };
- cAllocationPool<cChunkData::sChunkSection, 1600> Pool(std::auto_ptr<cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks>(new cStarvationCallbacks()));
+ 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;
diff --git a/tests/ChunkData/creatable.cpp b/tests/ChunkData/creatable.cpp
index 2bb61b7ce..fc786f688 100644
--- a/tests/ChunkData/creatable.cpp
+++ b/tests/ChunkData/creatable.cpp
@@ -4,14 +4,19 @@
int main(int argc, char** argv)
{
- class cStarvationCallbacks
- : public cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks
- {
- virtual void OnStartingUsingBuffer() {}
- virtual void OnStopUsingBuffer() {}
- virtual void OnBufferEmpty() {}
- };
- cAllocationPool<cChunkData::sChunkSection, 1600> Pool(std::auto_ptr<cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks>(new cStarvationCallbacks()));
+ 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;
}