Replaced constants with functions for type traits.

This commit is contained in:
unknown
2012-02-06 17:51:37 +01:00
parent 1ab1d9bed3
commit c483b44a41
18 changed files with 125 additions and 292 deletions

View File

@ -38,43 +38,43 @@ 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<Density8>::MinDensity, Density8::DensityType(0));
QCOMPARE(VoxelTypeTraits<Density8>::MaxDensity, Density8::DensityType(255));
QCOMPARE(VoxelTypeTraits<Density8>::minDensity(), Density8::DensityType(0));
QCOMPARE(VoxelTypeTraits<Density8>::maxDensity(), Density8::DensityType(255));
QCOMPARE(VoxelTypeTraits<DensityI8>::MinDensity, DensityI8::DensityType(-127));
QCOMPARE(VoxelTypeTraits<DensityI8>::MaxDensity, DensityI8::DensityType(127));
QCOMPARE(VoxelTypeTraits<DensityI8>::minDensity(), DensityI8::DensityType(-127));
QCOMPARE(VoxelTypeTraits<DensityI8>::maxDensity(), DensityI8::DensityType(127));
QCOMPARE(VoxelTypeTraits<DensityU8>::MinDensity, DensityU8::DensityType(0));
QCOMPARE(VoxelTypeTraits<DensityU8>::MaxDensity, DensityU8::DensityType(255));
QCOMPARE(VoxelTypeTraits<DensityU8>::minDensity(), DensityU8::DensityType(0));
QCOMPARE(VoxelTypeTraits<DensityU8>::maxDensity(), DensityU8::DensityType(255));
QCOMPARE(VoxelTypeTraits<Density16>::MinDensity, Density16::DensityType(0));
QCOMPARE(VoxelTypeTraits<Density16>::MaxDensity, Density16::DensityType(65535));
QCOMPARE(VoxelTypeTraits<Density16>::minDensity(), Density16::DensityType(0));
QCOMPARE(VoxelTypeTraits<Density16>::maxDensity(), Density16::DensityType(65535));
QCOMPARE(VoxelTypeTraits<DensityI16>::MinDensity, DensityI16::DensityType(-32767));
QCOMPARE(VoxelTypeTraits<DensityI16>::MaxDensity, DensityI16::DensityType(32767));
QCOMPARE(VoxelTypeTraits<DensityI16>::minDensity(), DensityI16::DensityType(-32767));
QCOMPARE(VoxelTypeTraits<DensityI16>::maxDensity(), DensityI16::DensityType(32767));
QCOMPARE(VoxelTypeTraits<DensityU16>::MinDensity, DensityU16::DensityType(0));
QCOMPARE(VoxelTypeTraits<DensityU16>::MaxDensity, DensityU16::DensityType(65535));
QCOMPARE(VoxelTypeTraits<DensityU16>::minDensity(), DensityU16::DensityType(0));
QCOMPARE(VoxelTypeTraits<DensityU16>::maxDensity(), DensityU16::DensityType(65535));
QCOMPARE(VoxelTypeTraits<DensityFloat>::MinDensity, FLT_MIN);
QCOMPARE(VoxelTypeTraits<DensityFloat>::MaxDensity, FLT_MAX);
QCOMPARE(VoxelTypeTraits<DensityFloat>::minDensity(), FLT_MIN);
QCOMPARE(VoxelTypeTraits<DensityFloat>::maxDensity(), FLT_MAX);
QCOMPARE(VoxelTypeTraits<DensityDouble>::MinDensity, DBL_MIN);
QCOMPARE(VoxelTypeTraits<DensityDouble>::MaxDensity, DBL_MAX);
QCOMPARE(VoxelTypeTraits<DensityDouble>::minDensity(), DBL_MIN);
QCOMPARE(VoxelTypeTraits<DensityDouble>::maxDensity(), DBL_MAX);
/*fValue = VoxelTypeTraits<DensityFloat>::MinDensity;
/*fValue = VoxelTypeTraits<DensityFloat>::minDensity();
QCOMPARE(fValue, -FLT_MAX);
fValue = VoxelTypeTraits<DensityFloat>::MaxDensity;
fValue = VoxelTypeTraits<DensityFloat>::maxDensity();
QCOMPARE(fValue, FLT_MAX);*/
/*iValue = VoxelTypeTraits<Material8>::MinDensity;
/*iValue = VoxelTypeTraits<Material8>::minDensity();
QCOMPARE(iValue, 0);
iValue = VoxelTypeTraits<Material8>::MaxDensity;
iValue = VoxelTypeTraits<Material8>::maxDensity();
QCOMPARE(iValue, 0);*/
/*iValue = VoxelTypeTraits<MaterialDensityPair44>::MinDensity;
/*iValue = VoxelTypeTraits<MaterialDensityPair44>::minDensity();
QCOMPARE(iValue, 0);
iValue = VoxelTypeTraits<MaterialDensityPair44>::MaxDensity;
iValue = VoxelTypeTraits<MaterialDensityPair44>::maxDensity();
QCOMPARE(iValue, 15);*/
}