Browse Source

Math: test that implicit conversion of T to Vector<T> won't compile.

"Won't compile" tests are another awesome feature of C++11.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
cc938a29dd
  1. 3
      src/Math/Test/Vector2Test.cpp
  2. 3
      src/Math/Test/Vector3Test.cpp
  3. 3
      src/Math/Test/Vector4Test.cpp
  4. 3
      src/Math/Test/VectorTest.cpp

3
src/Math/Test/Vector2Test.cpp

@ -107,6 +107,9 @@ void Vector2Test::constructOneValue() {
Vector2 a(3.0f); /* Not constexpr under GCC < 4.7 */
#endif
CORRADE_COMPARE(a, Vector2(3.0f, 3.0f));
/* Implicit conversion is not allowed */
CORRADE_VERIFY(!(std::is_convertible<Float, Vector2>::value));
}
void Vector2Test::constructConversion() {

3
src/Math/Test/Vector3Test.cpp

@ -114,6 +114,9 @@ void Vector3Test::constructOneValue() {
Vector3 a(-3.0f); /* Not constexpr under GCC < 4.7 */
#endif
CORRADE_COMPARE(a, Vector3(-3.0f, -3.0f, -3.0f));
/* Implicit conversion is not allowed */
CORRADE_VERIFY(!(std::is_convertible<Float, Vector3>::value));
}
void Vector3Test::constructParts() {

3
src/Math/Test/Vector4Test.cpp

@ -111,6 +111,9 @@ void Vector4Test::constructOneValue() {
Vector4 a(4.3f); /* Not constexpr under GCC < 4.7 */
#endif
CORRADE_COMPARE(a, Vector4(4.3f, 4.3f, 4.3f, 4.3f));
/* Implicit conversion is not allowed */
CORRADE_VERIFY(!(std::is_convertible<Float, Vector4>::value));
}
void Vector4Test::constructParts() {

3
src/Math/Test/VectorTest.cpp

@ -165,6 +165,9 @@ void VectorTest::constructOneValue() {
#endif
CORRADE_COMPARE(a, Vector4(7.25f, 7.25f, 7.25f, 7.25f));
/* Implicit conversion is not allowed */
CORRADE_VERIFY(!(std::is_convertible<Float, Vector4>::value));
}
void VectorTest::constructOneComponent() {

Loading…
Cancel
Save