Add GLM_META_PROG_HELPERS tests to each type

- Add new tests to the matrix types
- Add vector tests to use the static values instead of constants
- Wrap the quaternion tests in #ifdefs
- Add new tests to the simdMat4 and simdVec4 tests
This commit is contained in:
Jesse Talavera-Greenberg 2015-07-25 14:33:01 -04:00
parent f46249620a
commit 2a947b7ff1
17 changed files with 72 additions and 2 deletions

View File

@ -124,6 +124,11 @@ int main()
{ {
int Error(0); int Error(0);
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat2::rows == glm::mat2::row_type::components);
assert(glm::mat2::cols == glm::mat2::col_type::components);
#endif
Error += test_ctr(); Error += test_ctr();
Error += test_operators(); Error += test_operators();
Error += test_inverse(); Error += test_inverse();

View File

@ -98,6 +98,11 @@ int main()
{ {
int Error = 0; int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat2x3::rows == glm::mat2x3::row_type::components);
assert(glm::mat2x3::cols == glm::mat2x3::col_type::components);
#endif
Error += test_ctr(); Error += test_ctr();
Error += test_operators(); Error += test_operators();

View File

@ -98,6 +98,11 @@ int main()
{ {
int Error = 0; int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat2x4::rows == glm::mat2x4::row_type::components);
assert(glm::mat2x4::cols == glm::mat2x4::col_type::components);
#endif
Error += test_ctr(); Error += test_ctr();
Error += test_operators(); Error += test_operators();

View File

@ -102,6 +102,11 @@ int main()
{ {
int Error = 0; int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat3x2::rows == glm::mat3x2::row_type::components);
assert(glm::mat3x2::cols == glm::mat3x2::col_type::components);
#endif
Error += test_ctr(); Error += test_ctr();
Error += test_operators(); Error += test_operators();

View File

@ -161,6 +161,11 @@ int main()
{ {
int Error = 0; int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat3::rows == glm::mat3::row_type::components);
assert(glm::mat3::cols == glm::mat3::col_type::components);
#endif
Error += test_ctr(); Error += test_ctr();
Error += test_mat3x3(); Error += test_mat3x3();
Error += test_operators(); Error += test_operators();

View File

@ -102,6 +102,11 @@ int main()
{ {
int Error = 0; int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat3x4::rows == glm::mat3x4::row_type::components);
assert(glm::mat3x4::cols == glm::mat3x4::col_type::components);
#endif
Error += test_ctr(); Error += test_ctr();
Error += test_operators(); Error += test_operators();

View File

@ -106,6 +106,11 @@ int main()
{ {
int Error = 0; int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat4x2::rows == glm::mat4x2::row_type::components);
assert(glm::mat4x2::cols == glm::mat4x2::col_type::components);
#endif
Error += test_ctr(); Error += test_ctr();
Error += test_operators(); Error += test_operators();

View File

@ -106,6 +106,11 @@ int main()
{ {
int Error = 0; int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat4x3::rows == glm::mat4x3::row_type::components);
assert(glm::mat4x3::cols == glm::mat4x3::col_type::components);
#endif
Error += test_ctr(); Error += test_ctr();
Error += test_operators(); Error += test_operators();

View File

@ -278,6 +278,11 @@ int main()
{ {
int Error = 0; int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat4::rows == glm::mat4::row_type::components);
assert(glm::mat4::cols == glm::mat4::col_type::components);
#endif
Error += test_ctr(); Error += test_ctr();
Error += test_inverse_dmat4x4(); Error += test_inverse_dmat4x4();
Error += test_inverse_mat4x4(); Error += test_inverse_mat4x4();

View File

@ -190,6 +190,7 @@ int main()
assert(v.length() == 1); assert(v.length() == 1);
# ifdef GLM_META_PROG_HELPERS # ifdef GLM_META_PROG_HELPERS
assert(glm::vec1::components == glm::vec1().length());
assert(glm::vec1::components == 1); assert(glm::vec1::components == 1);
# endif # endif

View File

@ -349,6 +349,7 @@ int main()
assert(v.length() == 2); assert(v.length() == 2);
# ifdef GLM_META_PROG_HELPERS # ifdef GLM_META_PROG_HELPERS
assert(glm::vec2::components == glm::vec2().length());
assert(glm::vec2::components == 2); assert(glm::vec2::components == 2);
# endif # endif

View File

@ -517,6 +517,7 @@ int main()
assert(v.length() == 3); assert(v.length() == 3);
# ifdef GLM_META_PROG_HELPERS # ifdef GLM_META_PROG_HELPERS
assert(glm::vec3::components == glm::vec3().length());
assert(glm::vec3::components == 3); assert(glm::vec3::components == 3);
# endif # endif

View File

@ -493,6 +493,7 @@ int main()
assert(v.length() == 4); assert(v.length() == 4);
# ifdef GLM_META_PROG_HELPERS # ifdef GLM_META_PROG_HELPERS
assert(glm::vec4::components == glm::vec4().length());
assert(glm::vec4::components == 4); assert(glm::vec4::components == 4);
# endif # endif

View File

@ -325,7 +325,10 @@ int main()
{ {
int Error(0); int Error(0);
#ifdef GLM_META_PROG_HELPERS
assert(glm::quat::components == 4); assert(glm::quat::components == 4);
assert(glm::quat::components == glm::quat().length());
#endif
Error += test_quat_ctr(); Error += test_quat_ctr();
Error += test_quat_mul_vec(); Error += test_quat_mul_vec();

View File

@ -209,6 +209,10 @@ int main()
{ {
int Error(0); int Error(0);
#ifdef GLM_META_PROG_HELPERS
assert(glm::dualquat::components == glm::dualquat().length());
#endif
Error += test_dual_quat_ctr(); Error += test_dual_quat_ctr();
Error += test_dquat_type(); Error += test_dquat_type();
Error += test_scalars(); Error += test_scalars();

View File

@ -256,6 +256,15 @@ int main()
{ {
int Error = 0; int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::simdMat4::rows == glm::simdMat4::row_type::components);
assert(glm::simdMat4::cols == glm::simdMat4::col_type::components);
assert(glm::simdMat4::components == glm::simdMat4::pure_type::components);
assert(glm::simdMat4::rows == glm::simdMat4::pure_row_type::components);
assert(glm::simdMat4::cols == glm::simdMat4::pure_col_type::components);
#endif
std::vector<glm::mat4> Data(64 * 64 * 1); std::vector<glm::mat4> Data(64 * 64 * 1);
for(std::size_t i = 0; i < Data.size(); ++i) for(std::size_t i = 0; i < Data.size(); ++i)
Data[i] = glm::mat4( Data[i] = glm::mat4(

View File

@ -37,6 +37,11 @@
int main() int main()
{ {
#ifdef GLM_META_PROG_HELPERS
assert(glm::simdVec4::components == glm::simdVec4::pure_type::components);
#endif
glm::simdVec4 A1(0.0f, 0.1f, 0.2f, 0.3f); glm::simdVec4 A1(0.0f, 0.1f, 0.2f, 0.3f);
glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f); glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f);
glm::simdVec4 C1 = A1 + B1; glm::simdVec4 C1 = A1 + B1;