From ab0312be02bda8ddd33a187771842e2dacba4f74 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 1 Oct 2015 01:30:13 +0200 Subject: [PATCH] Added tests for affineInverse #192 --- test/gtc/gtc_matrix_inverse.cpp | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/test/gtc/gtc_matrix_inverse.cpp b/test/gtc/gtc_matrix_inverse.cpp index d9615d5b..88225a26 100644 --- a/test/gtc/gtc_matrix_inverse.cpp +++ b/test/gtc/gtc_matrix_inverse.cpp @@ -30,10 +30,53 @@ /////////////////////////////////////////////////////////////////////////////////// #include +#include + +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 Error = 0; + Error += test_affine(); + return Error; }