Skip to content
Snippets Groups Projects
Commit 7dc6081d authored by Tom Fischer's avatar Tom Fischer
Browse files

[MathLib] Vector3: Tests for operator*=.

parent 847d2f0d
No related branches found
No related tags found
No related merge requests found
......@@ -120,9 +120,10 @@ public:
double s,
TemplateVector3<T1> const& v);
TemplateVector3& operator*=(double pR)
TemplateVector3& operator*=(double s)
{
for (std::size_t i(0); i < 3; i++) this->_x[i] *= pR;
for (std::size_t i(0); i < 3; i++)
this->_x[i] *= s;
return *this;
}
......
......@@ -83,6 +83,13 @@ TEST(MathLib, TestVector3Operators)
ASSERT_NEAR(-4.0, res[0], std::numeric_limits<double>::min());
ASSERT_NEAR( 0.0, res[1], std::numeric_limits<double>::min());
ASSERT_NEAR( 4.0, res[2], std::numeric_limits<double>::min());
// test operator*=
v *= 2.0;
ASSERT_NEAR(2.0, v[0], std::numeric_limits<double>::min());
ASSERT_NEAR(6.0, v[1], std::numeric_limits<double>::min());
ASSERT_NEAR(10.0, v[2], std::numeric_limits<double>::min());
}
TEST(MathLib, TestVector3Multiplications)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment