From 6ed315b79b75a5ad31435d2ed8384bd53dce7367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 24 Feb 2013 14:16:26 +0100 Subject: [PATCH] Math: properly test constexpr in Complex from Vector2 constructor. --- src/Math/Test/ComplexTest.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Math/Test/ComplexTest.cpp b/src/Math/Test/ComplexTest.cpp index a93db8ccf..fcae80108 100644 --- a/src/Math/Test/ComplexTest.cpp +++ b/src/Math/Test/ComplexTest.cpp @@ -130,15 +130,21 @@ void ComplexTest::constExpressions() { constexpr Complex b(2.5f, -5.0f); CORRADE_COMPARE(b, Complex(2.5f, -5.0f)); + /* Vector constructor */ + constexpr Complex c(Vector2(-1.0f, 2.2f)); + CORRADE_COMPARE(c, Complex(-1.0f, 2.2f)); + /* Copy constructor */ - constexpr Complex c(b); - CORRADE_COMPARE(c, Complex(2.5f, -5.0f)); + constexpr Complex d(b); + CORRADE_COMPARE(d, Complex(2.5f, -5.0f)); /* Data access */ - constexpr float d = b.real(); - constexpr float e = c.imaginary(); - CORRADE_COMPARE(d, 2.5f); - CORRADE_COMPARE(e, -5.0f); + constexpr float e = b.real(); + constexpr float f = b.imaginary(); + constexpr Vector2 g(b); + CORRADE_COMPARE(e, 2.5f); + CORRADE_COMPARE(f, -5.0f); + CORRADE_COMPARE(g, Vector2(2.5f, -5.0f)); } void ComplexTest::addSubtract() {