forked from ZeusAFK/PMXViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglm_helper_test.cpp
More file actions
53 lines (47 loc) · 1.06 KB
/
glm_helper_test.cpp
File metadata and controls
53 lines (47 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "glm_helper.h"
#include "minunit.h"
#include <glm/gtx/quaternion.hpp>
#include <cstdio>
#include <iostream>
using namespace std;
int tests_run = 0;
static const char*
test_quat_euler()
{
const glm::vec3 original(0.1, 0.2, 0.3);
const glm::quat q = fromEulerAnglesRadians(original);
const glm::vec3 calculated = toEulerAnglesRadians(q);
mu_assert(glm::length(original - calculated) < 1e-5);
return 0;
}
static const char*
test_quat_euler_glm()
{
const glm::vec3 original(1, 1.5, 1);
const glm::quat q(original);
const glm::vec3 calculated = glm::radians(glm::eulerAngles(q));
mu_assert(glm::length(original - calculated) < 1e-5);
return 0;
}
static const char*
all_tests()
{
mu_run_test(test_quat_euler);
// mu_run_test(test_quat_euler_glm);
return 0;
}
int
main(int argc, char **argv)
{
const char *result = all_tests();
if (result != 0)
{
printf("%s\n", result);
}
else
{
printf("ALL TESTS PASSED\n");
}
printf("Tests run: %d\n", tests_run);
return result != 0;
}