Browse Source

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).
pull/7/head
Vladimír Vondruš 13 years ago
parent
commit
9bbc656da5
  1. 8
      src/Math/Test/VectorTest.cpp
  2. 5
      src/Math/Vector.h

8
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);

5
src/Math/Vector.h

@ -138,7 +138,10 @@ template<std::size_t size, class T> 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

Loading…
Cancel
Save