/******************************************************************************* Copyright (c) 2010 Matt Williams This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. *******************************************************************************/ #include "TestVoxels.h" #include "PolyVoxCore/Density.h" #include "PolyVoxCore/Material.h" #include "PolyVoxCore/MaterialDensityPair.h" #include #include using namespace PolyVox; void TestVoxels::testVoxelTypeLimits() { // It's worth testing these as they are not all explictily defined (e.g. Density8 is just a // typedef of DensityI8), and in the future we might define then with bitwise magic or something. QCOMPARE(VoxelTypeTraits::minDensity(), Density8::DensityType(0)); QCOMPARE(VoxelTypeTraits::maxDensity(), Density8::DensityType(255)); QCOMPARE(VoxelTypeTraits::minDensity(), DensityI8::DensityType(-127)); QCOMPARE(VoxelTypeTraits::maxDensity(), DensityI8::DensityType(127)); QCOMPARE(VoxelTypeTraits::minDensity(), DensityU8::DensityType(0)); QCOMPARE(VoxelTypeTraits::maxDensity(), DensityU8::DensityType(255)); QCOMPARE(VoxelTypeTraits::minDensity(), Density16::DensityType(0)); QCOMPARE(VoxelTypeTraits::maxDensity(), Density16::DensityType(65535)); QCOMPARE(VoxelTypeTraits::minDensity(), DensityI16::DensityType(-32767)); QCOMPARE(VoxelTypeTraits::maxDensity(), DensityI16::DensityType(32767)); QCOMPARE(VoxelTypeTraits::minDensity(), DensityU16::DensityType(0)); QCOMPARE(VoxelTypeTraits::maxDensity(), DensityU16::DensityType(65535)); QCOMPARE(VoxelTypeTraits::minDensity(), FLT_MIN); QCOMPARE(VoxelTypeTraits::maxDensity(), FLT_MAX); QCOMPARE(VoxelTypeTraits::minDensity(), DBL_MIN); QCOMPARE(VoxelTypeTraits::maxDensity(), DBL_MAX); /*fValue = VoxelTypeTraits::minDensity(); QCOMPARE(fValue, -FLT_MAX); fValue = VoxelTypeTraits::maxDensity(); QCOMPARE(fValue, FLT_MAX);*/ /*iValue = VoxelTypeTraits::minDensity(); QCOMPARE(iValue, 0); iValue = VoxelTypeTraits::maxDensity(); QCOMPARE(iValue, 0);*/ /*iValue = VoxelTypeTraits::minDensity(); QCOMPARE(iValue, 0); iValue = VoxelTypeTraits::maxDensity(); QCOMPARE(iValue, 15);*/ } QTEST_MAIN(TestVoxels)