From 407071dc9658bbac62184731d95bc5b3c929700b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 21 Mar 2013 23:27:16 +0100 Subject: [PATCH] Math: test also possibility of Unit implicit conversions. --- src/Math/Test/AngleTest.cpp | 5 +++-- src/Math/Test/UnitTest.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Math/Test/AngleTest.cpp b/src/Math/Test/AngleTest.cpp index 1feba3aa8..cdc3b3eba 100644 --- a/src/Math/Test/AngleTest.cpp +++ b/src/Math/Test/AngleTest.cpp @@ -128,10 +128,11 @@ void AngleTest::literals() { } void AngleTest::conversion() { - constexpr Deg a(Rad(1.57079633f)); + /* Implicit conversion should be allowed */ + constexpr Deg a = Rad(1.57079633f); CORRADE_COMPARE(Float(a), 90.0f); - constexpr Rad b(Deg(90.0f)); + constexpr Rad b = Deg(90.0f); CORRADE_COMPARE(Float(b), 1.57079633f); } diff --git a/src/Math/Test/UnitTest.cpp b/src/Math/Test/UnitTest.cpp index 1951fd127..805b0a4b1 100644 --- a/src/Math/Test/UnitTest.cpp +++ b/src/Math/Test/UnitTest.cpp @@ -64,6 +64,10 @@ inline Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, Sec val void UnitTest::construct() { constexpr Sec a(25.0f); CORRADE_COMPARE(Float(a), 25.0f); + + /* Implicit conversion is not allowed */ + CORRADE_VERIFY(!(std::is_convertible::value)); + CORRADE_VERIFY(!(std::is_convertible::value)); } void UnitTest::constructDefault() { @@ -75,6 +79,9 @@ void UnitTest::constructConversion() { constexpr Seci a(25.0); constexpr Sec b(a); CORRADE_COMPARE(b, Sec(25.0f)); + + /* Implicit conversion is not allowed */ + CORRADE_VERIFY(!(std::is_convertible::value)); } void UnitTest::compare() {