ViewTests.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. #include "tests/ViewTests.h"
  2. #include "math/View.h"
  3. #include "test/Test.h"
  4. using V3 = Core::Vector3;
  5. static void testFromAngles() {
  6. Core::View v;
  7. v.updateDirections(0.0f, 0.0f);
  8. CORE_TEST_VECTOR(V3(0.0f, 1.0f, 0.0f), v.getUp());
  9. CORE_TEST_VECTOR(V3(0.0f, -1.0f, 0.0f), v.getDown());
  10. CORE_TEST_VECTOR(V3(0.0f, 0.0f, -1.0f), v.getLeft());
  11. CORE_TEST_VECTOR(V3(0.0f, 0.0f, 1.0f), v.getRight());
  12. CORE_TEST_VECTOR(V3(1.0f, 0.0f, 0.0f), v.getFront());
  13. CORE_TEST_VECTOR(V3(-1.0f, 0.0f, 0.0f), v.getBack());
  14. }
  15. static void testFromQuaternion() {
  16. Core::View v;
  17. v.updateDirections(Core::Quaternion());
  18. CORE_TEST_VECTOR(V3(0.0f, 1.0f, 0.0f), v.getUp());
  19. CORE_TEST_VECTOR(V3(0.0f, -1.0f, 0.0f), v.getDown());
  20. CORE_TEST_VECTOR(V3(0.0f, 0.0f, -1.0f), v.getLeft());
  21. CORE_TEST_VECTOR(V3(0.0f, 0.0f, 1.0f), v.getRight());
  22. CORE_TEST_VECTOR(V3(1.0f, 0.0f, 0.0f), v.getFront());
  23. CORE_TEST_VECTOR(V3(-1.0f, 0.0f, 0.0f), v.getBack());
  24. }
  25. void Core::ViewTests::test() {
  26. testFromAngles();
  27. testFromQuaternion();
  28. }