Added tests for affineInverse #192

This commit is contained in:
Christophe Riccio 2015-10-01 01:30:13 +02:00
parent a77d311119
commit ab0312be02

View File

@ -30,10 +30,53 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <glm/gtc/matrix_inverse.hpp> #include <glm/gtc/matrix_inverse.hpp>
#include <glm/gtc/epsilon.hpp>
int test_affine()
{
int Error = 0;
{
glm::mat3 const M(
2.f, 0.f, 0.f,
0.f, 2.f, 0.f,
0.f, 0.f, 1.f);
glm::mat3 const A = glm::affineInverse(M);
glm::mat3 const I = glm::inverse(M);
glm::mat3 const R = glm::affineInverse(A);
Error += M != A;
Error += M == R;
Error += A == I;
}
{
glm::mat4 const M(
2.f, 0.f, 0.f, 0.f,
0.f, 2.f, 0.f, 0.f,
0.f, 0.f, 2.f, 0.f,
0.f, 0.f, 0.f, 1.f);
glm::mat4 const A = glm::affineInverse(M);
glm::mat4 const I = glm::inverse(M);
glm::mat4 const R = glm::affineInverse(A);
Error += M != A;
Error += M == R;
Error += A == I;
}
return Error;
}
int main() int main()
{ {
int Error = 0; int Error = 0;
Error += test_affine();
return Error; return Error;
} }