Bounds check added to get/setVoxelAt.

This commit is contained in:
David Williams
2010-06-15 20:32:14 +00:00
parent d0ebd53407
commit 29928b774d
4 changed files with 95 additions and 58 deletions

View File

@ -33,6 +33,18 @@ void TestVolume::testSize()
{
const uint16_t g_uVolumeSideLength = 128;
Volume<uint8_t> volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength);
//Note: Deliberatly go past each edge by one to test if the bounds checking works.
for (uint16_t z = 0; z < g_uVolumeSideLength + 1; z++)
{
for (uint16_t y = 0; y < g_uVolumeSideLength + 1; y++)
{
for (uint16_t x = 0; x < g_uVolumeSideLength + 1; x++)
{
volData.setVoxelAt(x,y,z,255);
}
}
}
volData.tidyUpMemory(0);