Skip to content

Commit

Permalink
Add more Vector3d unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
vahancho committed Jan 24, 2019
1 parent b268512 commit f964bf6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,31 @@ int main()
Vector3d v2{ 2.0, 2.0, 2.0 };
verifyDouble(v1.dot(v2), 12.0, LOCATION);
}
{
// Orthogonal vectors.
Vector3d v1{ 1.0, 0.0, 0.0 };
Vector3d v2{ 0.0, 1.0, 0.0 };
auto v3 = v1.cross(v2);
verifyDouble(v3.x(), 0.0, LOCATION);
verifyDouble(v3.y(), 0.0, LOCATION);
verifyDouble(v3.z(), 1.0, LOCATION);
}
{
Vector3d v1{ 3.0, 0.0, 0.0 };
Vector3d v2{ 0.0, 4.0, 0.0 };
auto v3 = v1.cross(v2);
verifyDouble(v3.x(), 0.0, LOCATION);
verifyDouble(v3.y(), 0.0, LOCATION);
verifyDouble(v3.z(), 12.0, LOCATION);
}
{
Vector3d v1{ 1.0, 2.0, 3.0 };
Vector3d v2{ 4.0, 5.0, 6.0 };
auto v3 = v1.cross(v2);
verifyDouble(v3.x(), -3.0, LOCATION);
verifyDouble(v3.y(), 6.0, LOCATION);
verifyDouble(v3.z(), -3.0, LOCATION);
}

//////////////////////////////////////////////////////////////////////////////

Expand Down

0 comments on commit f964bf6

Please sign in to comment.