Browse Source

Fixed tests to provide relevant output for CTest

Christophe Riccio 14 years ago
parent
commit
1c4abb3d73

+ 5 - 6
test/core/core_type_mat2x2.cpp

@@ -9,7 +9,7 @@
 
 #include <glm/glm.hpp>
 
-static bool test_operators()
+static int test_operators()
 {
 	glm::mat2x2 m(1.0f);
 	glm::vec2 u(1.0f);
@@ -24,15 +24,14 @@ static bool test_operators()
 	bool R = m != q;
 	bool S = m == m;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_operators();
+	Error += test_operators();
 
-	assert(Result);
-	return Result;
+	return Error;
 }

+ 5 - 6
test/core/core_type_mat2x3.cpp

@@ -9,7 +9,7 @@
 
 #include <glm/glm.hpp>
 
-static bool test_operators()
+static int test_operators()
 {
 	glm::mat2x3 m(1.0f);
 	glm::vec2 u(1.0f);
@@ -24,15 +24,14 @@ static bool test_operators()
 	bool R = m != q;
 	bool S = m == m;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_operators();
+	Error += test_operators();
 
-	assert(Result);
-	return Result;
+	return Error;
 }

+ 6 - 6
test/core/core_type_mat2x4.cpp

@@ -9,7 +9,7 @@
 
 #include <glm/glm.hpp>
 
-static bool test_operators()
+static int test_operators()
 {
 	glm::mat2x4 m(1.0f);
 	glm::vec2 u(1.0f);
@@ -24,17 +24,17 @@ static bool test_operators()
 	bool R = m != q;
 	bool S = m == m;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_operators();
+	Error += test_operators();
 
-	assert(Result);
-	return Result;
+	return Error;
 }
 
 
+

+ 5 - 5
test/core/core_type_mat3x2.cpp

@@ -24,16 +24,16 @@ static bool test_operators()
 	bool R = m != q;
 	bool S = m == m;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_operators();
+	Error += test_operators();
 
-	assert(Result);
-	return Result;
+	return Error;
 }
 
+

+ 8 - 9
test/core/core_type_mat3x3.cpp

@@ -18,7 +18,7 @@ void print(glm::dmat3 const & Mat0)
 	printf("\tvec3(%2.3f, %2.3f, %2.3f))\n\n", Mat0[2][0], Mat0[2][1], Mat0[2][2]);
 }
 
-bool test_mat3x3()
+int test_mat3x3()
 {
 	glm::dmat3 Mat0(
 		glm::dvec3(0.6f, 0.2f, 0.3f), 
@@ -31,10 +31,10 @@ bool test_mat3x3()
 	print(Inv0);
 	print(Res0);
 
-	return true;
+	return 0;
 }
 
-static bool test_operators()
+static int test_operators()
 {
 	glm::mat3x3 m(1.0f);
 	glm::vec3 u(1.0f);
@@ -49,17 +49,16 @@ static bool test_operators()
 	bool R = m != q;
 	bool S = m == m;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_mat3x3();
-	Result = Result && test_operators();
+	Error += test_mat3x3();
+	Error += test_operators();
 
-	assert(Result);
-	return Result;
+	return Error;
 }
 

+ 4 - 5
test/core/core_type_mat3x4.cpp

@@ -24,16 +24,15 @@ static bool test_operators()
 	bool R = m != q;
 	bool S = m == m;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_operators();
+	Error += test_operators();
 
-	assert(Result);
-	return Result;
+	return Error;
 }
 

+ 5 - 6
test/core/core_type_mat4x2.cpp

@@ -9,7 +9,7 @@
 
 #include <glm/glm.hpp>
 
-static bool test_operators()
+static int test_operators()
 {
 	glm::mat4x2 m(1.0f);
 	glm::vec4 u(1.0f);
@@ -24,16 +24,15 @@ static bool test_operators()
 	bool R = m != q;
 	bool S = m == m;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_operators();
+	Error += test_operators();
 
-	assert(Result);
-	return Result;
+	return Error;
 }
 

+ 5 - 6
test/core/core_type_mat4x3.cpp

@@ -9,7 +9,7 @@
 
 #include <glm/glm.hpp>
 
-static bool test_operators()
+static int test_operators()
 {
 	glm::mat4x3 m(1.0f);
 	glm::vec4 u(1.0f);
@@ -24,17 +24,16 @@ static bool test_operators()
 	bool R = m != q;
 	bool S = m == m;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_operators();
+	Error += test_operators();
 
-	assert(Result);
-	return Result;
+	return Error;
 }
 
 

+ 8 - 9
test/core/core_type_mat4x4.cpp

@@ -21,7 +21,7 @@ void print(glm::dmat4 const & Mat0)
 	printf("\tvec4(%2.3f, %2.3f, %2.3f, %2.3f))\n\n", Mat0[3][0], Mat0[3][1], Mat0[3][2], Mat0[3][3]);
 }
 
-bool test_mat4x4()
+int test_mat4x4()
 {
 	glm::dmat4 Mat0(
 		glm::dvec4(0.6f, 0.2f, 0.3f, 0.4f), 
@@ -35,7 +35,7 @@ bool test_mat4x4()
 	print(Inv0);
 	print(Res0);
 
-	return true;
+	return 0;
 }
 
 static bool test_operators()
@@ -53,16 +53,15 @@ static bool test_operators()
 	bool R = m != q;
 	bool S = m == m;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_mat4x4();
-	Result = Result && test_operators();
-	
-	assert(Result);
-	return Result;
+	Error += test_mat4x4();
+	Error += test_operators();
+
+	return Error;
 }

+ 5 - 6
test/core/core_type_vec1.cpp

@@ -9,22 +9,21 @@
 
 #include <glm/glm.hpp>
 
-static bool test_operators()
+static int test_operators()
 {
 	glm::vec4 A(1.0f);
 	glm::vec4 B(1.0f);
 	bool R = A != B;
 	bool S = A == B;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_operators();
+	Error += test_operators();
 	
-	assert(Result);
-	return Result;
+	return Error;
 }

+ 8 - 9
test/core/core_type_vec2.cpp

@@ -9,22 +9,21 @@
 
 #include <glm/glm.hpp>
 
-static bool test_operators()
+static int test_operators()
 {
-	glm::vec4 A(1.0f);
-	glm::vec4 B(1.0f);
+	glm::vec2 A(1.0f);
+	glm::vec2 B(1.0f);
 	bool R = A != B;
 	bool S = A == B;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_operators();
-	
-	assert(Result);
-	return Result;
+	Error += test_operators();
+
+	return Error;
 }

+ 7 - 8
test/core/core_type_vec3.cpp

@@ -9,22 +9,21 @@
 
 #include <glm/glm.hpp>
 
-static bool test_operators()
+static int test_operators()
 {
-	glm::vec4 A(1.0f);
-	glm::vec4 B(1.0f);
+	glm::vec3 A(1.0f);
+	glm::vec3 B(1.0f);
 	bool R = A != B;
 	bool S = A == B;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	bool Result = true;
+	int Error = 0;
 
-	Result = Result && test_operators();
+	Error += test_operators();
 	
-	assert(Result);
-	return Result;
+	return Error;
 }

+ 8 - 15
test/core/core_type_vec4.cpp

@@ -31,41 +31,34 @@ enum comp
 //	return _mm_shuffle_ps(Src, Src, mask<(int(W) << 6) | (int(Z) << 4) | (int(Y) << 2) | (int(X) << 0)>::value);
 //}
 
-bool test_hvec4()
+int test_hvec4()
 {
 	glm::hvec4 const A = glm::hvec4(0, 1, 2, 3);
 	//glm::hvec4 B = glm::swizzle<glm::X, glm::Y, glm::Z, glm::W>(A);
 
 	//glm::vec4 B = glm::detail::tvec##(glm::vec4::_size)<float>();
 
-	return true;
+	return 0;
 }
 
-static bool test_operators()
+static int test_operators()
 {
 	glm::vec4 A(1.0f);
 	glm::vec4 B(1.0f);
 	bool R = A != B;
 	bool S = A == B;
 
-	return true;
+	return (S && !R) ? 0 : 1;
 }
 
 int main()
 {
-	test_hvec4();
-
 	//__m128 DataA = swizzle<X, Y, Z, W>(glm::vec4(1.0f, 2.0f, 3.0f, 4.0f));
 	//__m128 DataB = swizzle<W, Z, Y, X>(glm::vec4(1.0f, 2.0f, 3.0f, 4.0f));
 
-	bool Result = true;
-
-	Result = Result && test_operators();
-	Result = Result && test_hvec4();
-	
-	assert(Result);
-	return Result;
-
-	return 0;
+	int Error = 0;
+	Error += test_operators();
+	Error += test_hvec4();
+	return Error;
 }
 

+ 2 - 2
test/gtc/gtc_quaternion.cpp

@@ -13,7 +13,7 @@
 
 int main()
 {
-	int Failed = 0;
+	int Error = -1;
 
-	return Failed;
+	return Error;
 }

+ 4 - 2
test/gtx/gtx-bit.cpp

@@ -129,6 +129,8 @@ namespace bitRevert
 
 int main()
 {
-	::extractField::test();
-	::bitRevert::test();
+	bool Error = 0;
+	Error += ::extractField::test();
+	Error += ::bitRevert::test();
+	return Error;
 }

+ 1 - 1
test/gtx/gtx-simd-vec4.cpp

@@ -16,7 +16,7 @@ int main()
 	glm::simdVec4 A1(0.0f, 0.1f, 0.2f, 0.3f);
 	glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f);
 	glm::simdVec4 C1 = A1 + B1;
-	glm::simdVec4 D1 = A1.swizzle<glm::X, glm::Z, glm::Y, glm::W>();
+	//glm::simdVec4 D1 = A1.swizzle<glm::X, glm::Z, glm::Y, glm::W>();
 	glm::simdVec4 E1(glm::vec4(1.0f));
 	glm::vec4 F1 = glm::vec4_cast(E1);
 	//glm::vec4 G1(E1);