Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
test vector3 using matrix::isEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Feb 25, 2017
1 parent d81ddb0 commit cf92495
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <matrix/math.hpp>

using matrix::Vector;
using matrix::isEqualF;
using matrix::Vector;

int main()
{
Expand Down
2 changes: 1 addition & 1 deletion test/vector2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include "test_macros.hpp"

using matrix::Vector2f;
using matrix::Matrix;
using matrix::Vector2f;

int main()
{
Expand Down
26 changes: 14 additions & 12 deletions test/vector3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,33 @@

#include <matrix/math.hpp>

using matrix::Vector3f;
using matrix::isEqual;
using matrix::isEqualF;
using matrix::Matrix;
using matrix::Vector3f;

int main()
{
Vector3f a(1, 0, 0);
Vector3f b(0, 1, 0);
Vector3f c = a.cross(b);
TEST(matrix::isEqual(c, Vector3f(0,0,1)));
TEST(isEqual(c, Vector3f(0,0,1)));
c = a % b;
TEST(matrix::isEqual(c, Vector3f(0,0,1)));
TEST(isEqual(c, Vector3f(0,0,1)));
Matrix<float, 3, 1> d(c);
Vector3f e(d);
TEST (matrix::isEqual(e, d));
TEST(isEqual(e, d));
float data[] = {4, 5, 6};
Vector3f f(data);
TEST(matrix::isEqual(f, Vector3f(4, 5, 6)));
TEST(isEqual(f, Vector3f(4, 5, 6)));

TEST(matrix::isEqual(a + b, Vector3f(1, 1, 0)));
TEST(matrix::isEqual(a - b, Vector3f(1, -1, 0)));
TEST(matrix::isEqualF(a * b, 0.0f));
TEST(matrix::isEqual(-a, Vector3f(-1, 0, 0)));
TEST(matrix::isEqual(a.unit(), a));
TEST(matrix::isEqual(a.unit(), a.normalized()));
TEST(matrix::isEqual(a*2.0, Vector3f(2, 0, 0)));
TEST(isEqual(a + b, Vector3f(1, 1, 0)));
TEST(isEqual(a - b, Vector3f(1, -1, 0)));
TEST(isEqualF(a * b, 0.0f));
TEST(isEqual(-a, Vector3f(-1, 0, 0)));
TEST(isEqual(a.unit(), a));
TEST(isEqual(a.unit(), a.normalized()));
TEST(isEqual(a*2.0, Vector3f(2, 0, 0)));

return 0;
}
Expand Down

0 comments on commit cf92495

Please sign in to comment.