Basics unit tests found some bugs!

This commit is contained in:
Eryn Wells 2014-08-09 22:00:54 -07:00
parent 1f01de6393
commit a5f451a120
3 changed files with 72 additions and 68 deletions

View file

@ -165,7 +165,7 @@ bool
Matrix<N,M>::operator==(const Matrix<N,M>& rhs)
const
{
for (int i = 0; i < N*M; i++) {
for (UInt i = 0; i < N*M; i++) {
/* TODO: Use NearlyEqual. */
if (mData[i] != rhs.mData[i]) {
return false;
@ -254,7 +254,7 @@ Matrix<N,M>::operator*(Matrix<M,P> rhs)
/* Each cell is Sigma(k=0, M)(lhs[ik] * rhs[kj]) */
result(i, j) = 0.0;
for (UInt k = 0; k < M; k++) {
result(i, j) += mData[i*N + k] * rhs(k*P, j);
result(i, j) += mData[i*N + k] * rhs(k, j);
}
}
}

View file

@ -93,7 +93,7 @@ Vector4
Vector4::operator*(const Double& rhs)
const
{
return static_cast<Vector4&&>(*this * rhs);
return static_cast<Matrix<4,1>>(*this) * rhs;
}
@ -182,7 +182,7 @@ Double
Vector4::Dot(const Vector4& rhs)
const
{
return mData[0] * rhs.mData[0] + mData[1] * rhs.mData[1] + mData[2] + rhs.mData[2];
return mData[0] * rhs.mData[0] + mData[1] * rhs.mData[1] + mData[2] * rhs.mData[2];
}