summaryrefslogtreecommitdiffstats
path: root/tests/ChunkData
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ChunkData')
-rw-r--r--tests/ChunkData/ArraytoCoord.cpp15
-rw-r--r--tests/ChunkData/Coordinates.cpp10
-rw-r--r--tests/ChunkData/Copies.cpp18
-rw-r--r--tests/ChunkData/creatable.cpp10
4 files changed, 40 insertions, 13 deletions
diff --git a/tests/ChunkData/ArraytoCoord.cpp b/tests/ChunkData/ArraytoCoord.cpp
index 1138fb5b6..f800d8e05 100644
--- a/tests/ChunkData/ArraytoCoord.cpp
+++ b/tests/ChunkData/ArraytoCoord.cpp
@@ -6,9 +6,18 @@
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()));
+ {
+
// Test first segment
- cChunkData buffer;
+ cChunkData buffer(Pool);
BLOCKTYPE SrcBlockBuffer[16 * 16 * 256];
memset(SrcBlockBuffer, 0x00, 16 * 16 * 256);
@@ -35,7 +44,7 @@ int main(int argc, char** argv)
{
// test following segment
- cChunkData buffer;
+ cChunkData buffer(Pool);
BLOCKTYPE SrcBlockBuffer[16 * 16 * 256];
memset(SrcBlockBuffer, 0x00, 16 * 16 * 256);
@@ -62,7 +71,7 @@ int main(int argc, char** argv)
{
// test zeros
- cChunkData buffer;
+ cChunkData buffer(Pool);
BLOCKTYPE SrcBlockBuffer[16 * 16 * 256];
memset(SrcBlockBuffer, 0x00, 16 * 16 * 256);
diff --git a/tests/ChunkData/Coordinates.cpp b/tests/ChunkData/Coordinates.cpp
index f02b68d40..f94532183 100644
--- a/tests/ChunkData/Coordinates.cpp
+++ b/tests/ChunkData/Coordinates.cpp
@@ -6,6 +6,8 @@
int main(int argc, char** argv)
{
+ class cStarvationCallbacks
+ : public cAllocationPool<cChunkData::sChunkSection,1600>::cStarvationCallbacks
{
cChunkData buffer;
@@ -105,7 +107,7 @@ int main(int argc, char** argv)
}
{
- cChunkData buffer;
+ cChunkData buffer(Pool);
// Zero's
buffer.SetBlock(0, 0, 0, 0x0);
@@ -122,9 +124,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
@@ -136,7 +138,7 @@ int main(int argc, char** argv)
#else
copy = std::move(copy);
#endif
- testassert(copy.GetBlock(0, 0, 0) == 0x42);
+ testassert(copy.GetBlock(0,0,0) == 0x42);
}
return 0;
diff --git a/tests/ChunkData/Copies.cpp b/tests/ChunkData/Copies.cpp
index b10ddb759..502a969e8 100644
--- a/tests/ChunkData/Copies.cpp
+++ b/tests/ChunkData/Copies.cpp
@@ -6,8 +6,16 @@
int main(int argc, char** argv)
{
+ class cStarvationCallbacks
+ : public cAllocationPool<cChunkData::sChunkSection,1600>::cStarvationCallbacks
{
- cChunkData buffer;
+ virtual void OnStartingUsingBuffer() {}
+ virtual void OnStopUsingBuffer() {}
+ virtual void OnBufferEmpty() {}
+ };
+ cAllocationPool<cChunkData::sChunkSection,1600> Pool(std::auto_ptr<cAllocationPool<cChunkData::sChunkSection,1600>::cStarvationCallbacks>(new cStarvationCallbacks()));
+ {
+ cChunkData buffer(Pool);
buffer.SetBlock(3, 1, 4, 0xDE);
buffer.SetMeta(3, 1, 4, 0xA);
@@ -37,7 +45,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)
@@ -61,7 +69,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)
@@ -85,7 +93,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)
@@ -109,7 +117,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/creatable.cpp b/tests/ChunkData/creatable.cpp
index 74025cb14..78b1a82d1 100644
--- a/tests/ChunkData/creatable.cpp
+++ b/tests/ChunkData/creatable.cpp
@@ -4,6 +4,14 @@
int main(int argc, char** argv)
{
- cChunkData buffer;
+ 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()));
+ cChunkData buffer(Pool);
return 0;
}