Browse Source

Fixed warnings

Christophe Riccio 8 years ago
parent
commit
ac8d625d23
2 changed files with 9 additions and 7 deletions
  1. 5 5
      test/gtc/gtc_packing.cpp
  2. 4 2
      test/gtx/gtx_matrix_factorisation.cpp

+ 5 - 5
test/gtc/gtc_packing.cpp

@@ -69,11 +69,11 @@ int test_Half1x16()
 
 	for(std::size_t i = 0; i < Tests.size(); ++i)
 	{
-		glm::uint32 p0 = glm::packHalf1x16(Tests[i]);
+		glm::uint16 p0 = glm::packHalf1x16(Tests[i]);
 		float v0 = glm::unpackHalf1x16(p0);
-		glm::uint32 p1 = glm::packHalf1x16(v0);
+		glm::uint16 p1 = glm::packHalf1x16(v0);
 		float v1 = glm::unpackHalf1x16(p1);
-		Error += (v0 == v1) ? 0 : 1;
+		Error += glm::epsilonEqual(v0, v1, glm::epsilon<float>()) ? 0 : 1;
 	}
 
 	return Error;
@@ -294,7 +294,7 @@ int test_packUnorm1x16()
 	for(std::size_t i = 0; i < A.size(); ++i)
 	{
 		glm::vec1 B(A[i]);
-		glm::uint32 C = glm::packUnorm1x16(B.x);
+		glm::uint16 C = glm::packUnorm1x16(B.x);
 		glm::vec1 D(glm::unpackUnorm1x16(C));
 		Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 65535.f)) ? 0 : 1;
 		assert(!Error);
@@ -316,7 +316,7 @@ int test_packSnorm1x16()
 	for(std::size_t i = 0; i < A.size(); ++i)
 	{
 		glm::vec1 B(A[i]);
-		glm::uint32 C = glm::packSnorm1x16(B.x);
+		glm::uint16 C = glm::packSnorm1x16(B.x);
 		glm::vec1 D(glm::unpackSnorm1x16(C));
 		Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 32767.0f * 2.0f)) ? 0 : 1;
 	}

+ 4 - 2
test/gtx/gtx_matrix_factorisation.cpp

@@ -1,5 +1,7 @@
 #define GLM_ENABLE_EXPERIMENTAL
 #include <glm/gtx/matrix_factorisation.hpp>
+#include <glm/gtc/constants.hpp>
+#include <glm/gtc/epsilon.hpp>
 
 float const epsilon = 1e-10f;
 
@@ -33,7 +35,7 @@ int test_qr(matType<C, R, T, P> m)
 	//Test if the matrix r is upper triangular
 	for (glm::length_t i = 0; i < C; i++)
 	for (glm::length_t j = i + 1; j < (C < R ? C : R); j++)
-			Error += r[i][j] != 0 ? 1 : 0;
+		Error += glm::epsilonEqual(r[i][j], static_cast<T>(0), glm::epsilon<T>()) ? 0 : 1;
 
 	return Error;
 }
@@ -70,7 +72,7 @@ int test_rq(matType<C, R, T, P> m)
 	//Test if the matrix r is upper triangular
 	for (glm::length_t i = 0; i < (C < R ? C : R); i++)
 	for (glm::length_t j = R - (C < R ? C : R) + i + 1; j < R; j++)
-		Error += r[i][j] != 0 ? 1 : 0;
+		Error += glm::epsilonEqual(r[i][j], static_cast<T>(0), glm::epsilon<T>()) ? 0 : 1;
 
 	return Error;
 }