diff --git a/src/Math/Test/SwizzleTest.cpp b/src/Math/Test/SwizzleTest.cpp index 9df00e89f..795d4297a 100644 --- a/src/Math/Test/SwizzleTest.cpp +++ b/src/Math/Test/SwizzleTest.cpp @@ -26,6 +26,7 @@ class SwizzleTest: public Corrade::TestSuite::Tester { void components(); void constants(); void sizes(); + void constExpressions(); }; typedef Vector<4, std::int32_t> Vector4i; @@ -33,7 +34,8 @@ typedef Vector<4, std::int32_t> Vector4i; SwizzleTest::SwizzleTest() { addTests(&SwizzleTest::components, &SwizzleTest::constants, - &SwizzleTest::sizes); + &SwizzleTest::sizes, + &SwizzleTest::constExpressions); } void SwizzleTest::components() { @@ -53,6 +55,14 @@ void SwizzleTest::sizes() { (Math::Vector<7, std::int32_t>(3, 1, 4, 2, 3, 2, 1))); } +void SwizzleTest::constExpressions() { + constexpr auto a = swizzle<'z', 'x', 'w', 'y'>(Vector4i(2, 4, 5, 7)); + CORRADE_COMPARE(a, Vector4i(5, 2, 7, 4)); + + constexpr auto b = swizzle<'1', 'w', '0', 'y'>(Vector4i(2, 4, 5, 7)); + CORRADE_COMPARE(b, Vector4i(1, 7, 0, 4)); +} + }}} CORRADE_TEST_MAIN(Magnum::Math::Test::SwizzleTest)