From 9bbc656da5f21dc34752e9e45d48122c75849d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 27 Jan 2013 00:47:34 +0100 Subject: [PATCH] Math: creating Vector from one value is broken. Added "expect fail" test, it is not the priority now (and it is handled correctly in subclasses). --- src/Math/Test/VectorTest.cpp | 8 ++++++++ src/Math/Vector.h | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Math/Test/VectorTest.cpp b/src/Math/Test/VectorTest.cpp index bf42ef228..d5130414f 100644 --- a/src/Math/Test/VectorTest.cpp +++ b/src/Math/Test/VectorTest.cpp @@ -30,6 +30,7 @@ class VectorTest: public Corrade::TestSuite::Tester { void constructFromData(); void constructDefault(); + void constructOneValue(); void constructConversion(); void data(); @@ -66,6 +67,7 @@ typedef Vector<4, std::int32_t> Vector4i; VectorTest::VectorTest() { addTests(&VectorTest::constructFromData, &VectorTest::constructDefault, + &VectorTest::constructOneValue, &VectorTest::constructConversion, &VectorTest::data, @@ -104,6 +106,12 @@ void VectorTest::constructDefault() { CORRADE_COMPARE(Vector4(), Vector4(0.0f, 0.0f, 0.0f, 0.0f)); } +void VectorTest::constructOneValue() { + CORRADE_EXPECT_FAIL("Constructing Vector from one value is broken."); + CORRADE_VERIFY(false); +// CORRADE_COMPARE(Vector4(7.25f), Vector4(7.25f, 7.25f, 7.25f, 7.25f)); +} + void VectorTest::constructConversion() { Vector4 floatingPoint(1.3f, 2.7f, -15.0f, 7.0f); Vector4 floatingPointRounded(1.0f, 2.0f, -15.0f, 7.0f); diff --git a/src/Math/Vector.h b/src/Math/Vector.h index a8f912ca3..6758d19de 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -138,7 +138,10 @@ template class Vector { static_assert(sizeof...(next)+1 == size, "Improper number of arguments passed to Vector constructor"); } - /** @brief Construct vector with one value for all fields */ + /** + * @brief Construct vector with one value for all fields + * @todo Fix this to be actually usable (not only in subclasses) + */ #ifdef DOXYGEN_GENERATING_OUTPUT inline explicit Vector(T value) { #else