|
|
|
|
@ -134,11 +134,13 @@ void FunctionsTest::normalizeUnsigned() {
|
|
|
|
|
CORRADE_COMPARE((Math::normalize<Float, UnsignedByte>(0)), 0.0f); |
|
|
|
|
CORRADE_COMPARE((Math::normalize<Float, UnsignedByte>(255)), 1.0f); |
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
CORRADE_COMPARE((Math::normalize<Double, UnsignedInt>(0)), 0.0); |
|
|
|
|
CORRADE_COMPARE((Math::normalize<Double, UnsignedInt>(std::numeric_limits<UnsignedInt>::max())), 1.0); |
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE((Math::normalize<long double, UnsignedLong>(0)), 0.0); |
|
|
|
|
CORRADE_COMPARE((Math::normalize<long double, UnsignedLong>(std::numeric_limits<UnsignedLong>::max())), 1.0); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE((Math::normalize<Float, UnsignedShort>(0)), 0.0f); |
|
|
|
|
CORRADE_COMPARE((Math::normalize<Float, UnsignedShort>(std::numeric_limits<UnsignedShort>::max())), 1.0f); |
|
|
|
|
@ -158,6 +160,7 @@ void FunctionsTest::normalizeSigned() {
|
|
|
|
|
CORRADE_COMPARE((Math::normalize<Float, Short>(0)), 0.0f); |
|
|
|
|
CORRADE_COMPARE((Math::normalize<Float, Short>(std::numeric_limits<Short>::max())), 1.0f); |
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
CORRADE_COMPARE((Math::normalize<Double, Int>(std::numeric_limits<Int>::min())), -1.0); |
|
|
|
|
CORRADE_COMPARE((Math::normalize<Double, Int>(0)), 0.0); |
|
|
|
|
CORRADE_COMPARE((Math::normalize<Double, Int>(std::numeric_limits<Int>::max())), 1.0); |
|
|
|
|
@ -165,6 +168,7 @@ void FunctionsTest::normalizeSigned() {
|
|
|
|
|
CORRADE_COMPARE((Math::normalize<long double, Long>(std::numeric_limits<Long>::min())), -1.0); |
|
|
|
|
CORRADE_COMPARE((Math::normalize<long double, Long>(0)), 0.0); |
|
|
|
|
CORRADE_COMPARE((Math::normalize<long double, Long>(std::numeric_limits<Long>::max())), 1.0); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE((Math::normalize<Float, Short>(16384)), 0.500015f); |
|
|
|
|
CORRADE_COMPARE((Math::normalize<Float, Short>(-16384)), -0.500015f); |
|
|
|
|
@ -179,6 +183,7 @@ void FunctionsTest::denormalizeUnsigned() {
|
|
|
|
|
CORRADE_COMPARE(Math::denormalize<UnsignedShort>(0.0f), 0); |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<UnsignedShort>(1.0f), std::numeric_limits<UnsignedShort>::max()); |
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<UnsignedInt>(0.0), 0); |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<UnsignedInt>(1.0), std::numeric_limits<UnsignedInt>::max()); |
|
|
|
|
|
|
|
|
|
@ -188,6 +193,7 @@ void FunctionsTest::denormalizeUnsigned() {
|
|
|
|
|
CORRADE_VERIFY(false); |
|
|
|
|
//CORRADE_COMPARE(Math::denormalize<UnsignedLong>(1.0), std::numeric_limits<UnsignedLong>::max());
|
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE(Math::denormalize<UnsignedShort>(0.33f), 21626); |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<UnsignedShort>(0.66f), 43253); |
|
|
|
|
@ -204,6 +210,7 @@ void FunctionsTest::denormalizeSigned() {
|
|
|
|
|
CORRADE_COMPARE(Math::denormalize<Short>(0.0f), 0); |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<Short>(1.0f), std::numeric_limits<Short>::max()); |
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<Int>(-1.0), std::numeric_limits<Int>::min()+1); |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<Int>(0.0), 0); |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<Int>(1.0), std::numeric_limits<Int>::max()); |
|
|
|
|
@ -211,6 +218,7 @@ void FunctionsTest::denormalizeSigned() {
|
|
|
|
|
CORRADE_COMPARE(Math::denormalize<Long>(-1.0l), std::numeric_limits<Long>::min()+1); |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<Long>(0.0l), 0); |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<Long>(1.0l), std::numeric_limits<Long>::max()); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE(Math::denormalize<Short>(-0.33f), -10813); |
|
|
|
|
CORRADE_COMPARE(Math::denormalize<Short>(0.66f), 21626); |
|
|
|
|
@ -225,11 +233,13 @@ void FunctionsTest::renormalizeUnsinged() {
|
|
|
|
|
CORRADE_COMPARE(Math::normalize<Float>(Math::denormalize<UnsignedShort>(0.0f)), 0.0f); |
|
|
|
|
CORRADE_COMPARE(Math::normalize<Float>(Math::denormalize<UnsignedShort>(1.0f)), 1.0f); |
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
CORRADE_COMPARE(Math::normalize<Double>(Math::denormalize<UnsignedInt>(0.0)), 0.0); |
|
|
|
|
CORRADE_COMPARE(Math::normalize<Double>(Math::denormalize<UnsignedInt>(1.0)), 1.0); |
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE(Math::normalize<long double>(Math::denormalize<UnsignedLong>(0.0l)), 0.0l); |
|
|
|
|
CORRADE_COMPARE(Math::normalize<long double>(Math::denormalize<UnsignedLong>(1.0l)), 1.0l); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void FunctionsTest::renormalizeSinged() { |
|
|
|
|
@ -241,6 +251,7 @@ void FunctionsTest::renormalizeSinged() {
|
|
|
|
|
CORRADE_COMPARE(Math::normalize<Float>(Math::denormalize<Short>(0.0f)), 0.0f); |
|
|
|
|
CORRADE_COMPARE(Math::normalize<Float>(Math::denormalize<Short>(1.0f)), 1.0f); |
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
CORRADE_COMPARE(Math::normalize<Double>(Math::denormalize<Int>(-1.0)), -1.0); |
|
|
|
|
CORRADE_COMPARE(Math::normalize<Double>(Math::denormalize<Int>(0.0)), 0.0); |
|
|
|
|
CORRADE_COMPARE(Math::normalize<Double>(Math::denormalize<Int>(1.0)), 1.0); |
|
|
|
|
@ -248,6 +259,7 @@ void FunctionsTest::renormalizeSinged() {
|
|
|
|
|
CORRADE_COMPARE(Math::normalize<long double>(Math::denormalize<Long>(-1.0l)), -1.0l); |
|
|
|
|
CORRADE_COMPARE(Math::normalize<long double>(Math::denormalize<Long>(0.0l)), 0.0l); |
|
|
|
|
CORRADE_COMPARE(Math::normalize<long double>(Math::denormalize<Long>(1.0l)), 1.0l); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void FunctionsTest::normalizeTypeDeduction() { |
|
|
|
|
|