Skip to content

Commit

Permalink
Added test for quat type component length() static #565
Browse files Browse the repository at this point in the history
  • Loading branch information
Groovounet committed Nov 1, 2016
1 parent f3fc2b2 commit c4f52dc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
17 changes: 16 additions & 1 deletion test/gtc/gtc_quaternion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,23 @@ int test_quat_ctr()
return Error;
}

int test_size()
{
int Error = 0;

Error += 16 == sizeof(glm::quat) ? 0 : 1;
Error += 32 == sizeof(glm::dquat) ? 0 : 1;
Error += glm::quat().length() == 4 ? 0 : 1;
Error += glm::dquat().length() == 4 ? 0 : 1;
Error += glm::quat::length() == 4 ? 0 : 1;
Error += glm::dquat::length() == 4 ? 0 : 1;

return Error;
}

int main()
{
int Error(0);
int Error = 0;

Error += test_quat_ctr();
Error += test_quat_mul_vec();
Expand All @@ -307,6 +321,7 @@ int main()
Error += test_quat_normalize();
Error += test_quat_euler();
Error += test_quat_slerp();
Error += test_size();

return Error;
}
17 changes: 16 additions & 1 deletion test/gtx/gtx_dual_quaternion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,30 @@ int test_dual_quat_ctr()
return Error;
}

int test_size()
{
int Error = 0;

Error += 32 == sizeof(glm::dualquat) ? 0 : 1;
Error += 64 == sizeof(glm::ddualquat) ? 0 : 1;
Error += glm::dualquat().length() == 2 ? 0 : 1;
Error += glm::ddualquat().length() == 2 ? 0 : 1;
Error += glm::dualquat::length() == 2 ? 0 : 1;
Error += glm::ddualquat::length() == 2 ? 0 : 1;

return Error;
}

int main()
{
int Error(0);
int Error = 0;

Error += test_dual_quat_ctr();
Error += test_dquat_type();
Error += test_scalars();
Error += test_inverse();
Error += test_mul();
Error += test_size();

return Error;
}
2 changes: 1 addition & 1 deletion test/gtx/gtx_quaternion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int test_log()

int main()
{
int Error(0);
int Error = 0;

Error += test_log();
Error += test_rotation();
Expand Down

0 comments on commit c4f52dc

Please # to comment.