Browse Source

Math: test for size of long double.

In order to have predictable results in the tests.
pull/187/head^2
Vladimír Vondruš 10 years ago
parent
commit
c47f8e04e3
  1. 18
      src/Magnum/Math/Test/TypeTraitsTest.cpp

18
src/Magnum/Math/Test/TypeTraitsTest.cpp

@ -36,6 +36,7 @@ namespace Magnum { namespace Math { namespace Test {
struct TypeTraitsTest: Corrade::TestSuite::Tester {
explicit TypeTraitsTest();
void sizeOfLongDouble();
void name();
template<class T> void equalsIntegral();
@ -94,7 +95,8 @@ struct {
}
TypeTraitsTest::TypeTraitsTest() {
addTests({&TypeTraitsTest::name,
addTests({&TypeTraitsTest::sizeOfLongDouble,
&TypeTraitsTest::name,
&TypeTraitsTest::equalsIntegral<UnsignedByte>,
&TypeTraitsTest::equalsIntegral<Byte>,
@ -148,6 +150,20 @@ TypeTraitsTest::TypeTraitsTest() {
}, EqualsZeroDataCount);
}
void TypeTraitsTest::sizeOfLongDouble() {
#ifdef CORRADE_TARGET_EMSCRIPTEN
CORRADE_SKIP("Not defined in Emscripten.");
#else
#ifdef _MSC_VER
CORRADE_COMPARE(sizeof(long double), 8);
CORRADE_EXPECT_FAIL("long double is equivalent to double on MSVC.");
#endif
/* It's 80 bit, but has to be aligned somehow, so 128 bits / 16 bytes */
CORRADE_COMPARE(sizeof(long double), 16);
#endif
}
void TypeTraitsTest::name() {
CORRADE_COMPARE(TypeTraits<UnsignedShort>::name(), "UnsignedShort");
CORRADE_COMPARE(TypeTraits<Float>::name(), "Float");

Loading…
Cancel
Save