From 1c4abb3d736f35762c1d47a90dc41e87a07287bc Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 2 May 2011 23:38:55 +0100 Subject: [PATCH] Fixed tests to provide relevant output for CTest --- test/core/core_type_mat2x2.cpp | 11 +++++------ test/core/core_type_mat2x3.cpp | 11 +++++------ test/core/core_type_mat2x4.cpp | 12 ++++++------ test/core/core_type_mat3x2.cpp | 10 +++++----- test/core/core_type_mat3x3.cpp | 17 ++++++++--------- test/core/core_type_mat3x4.cpp | 9 ++++----- test/core/core_type_mat4x2.cpp | 11 +++++------ test/core/core_type_mat4x3.cpp | 11 +++++------ test/core/core_type_mat4x4.cpp | 17 ++++++++--------- test/core/core_type_vec1.cpp | 11 +++++------ test/core/core_type_vec2.cpp | 17 ++++++++--------- test/core/core_type_vec3.cpp | 15 +++++++-------- test/core/core_type_vec4.cpp | 23 ++++++++--------------- test/gtc/gtc_quaternion.cpp | 4 ++-- test/gtx/gtx-bit.cpp | 6 ++++-- test/gtx/gtx-simd-vec4.cpp | 2 +- 16 files changed, 86 insertions(+), 101 deletions(-) diff --git a/test/core/core_type_mat2x2.cpp b/test/core/core_type_mat2x2.cpp index ce188d8ae..23b6bd813 100644 --- a/test/core/core_type_mat2x2.cpp +++ b/test/core/core_type_mat2x2.cpp @@ -9,7 +9,7 @@ #include -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; } diff --git a/test/core/core_type_mat2x3.cpp b/test/core/core_type_mat2x3.cpp index 92331d8eb..f6311b96c 100644 --- a/test/core/core_type_mat2x3.cpp +++ b/test/core/core_type_mat2x3.cpp @@ -9,7 +9,7 @@ #include -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; } diff --git a/test/core/core_type_mat2x4.cpp b/test/core/core_type_mat2x4.cpp index f13db087f..fad79409b 100644 --- a/test/core/core_type_mat2x4.cpp +++ b/test/core/core_type_mat2x4.cpp @@ -9,7 +9,7 @@ #include -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; } + diff --git a/test/core/core_type_mat3x2.cpp b/test/core/core_type_mat3x2.cpp index 8e9c8da83..7193cd8ad 100644 --- a/test/core/core_type_mat3x2.cpp +++ b/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; } + diff --git a/test/core/core_type_mat3x3.cpp b/test/core/core_type_mat3x3.cpp index 4daa19296..26a4933c6 100644 --- a/test/core/core_type_mat3x3.cpp +++ b/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; } diff --git a/test/core/core_type_mat3x4.cpp b/test/core/core_type_mat3x4.cpp index 69a0ccad2..8e36b67ac 100644 --- a/test/core/core_type_mat3x4.cpp +++ b/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; } diff --git a/test/core/core_type_mat4x2.cpp b/test/core/core_type_mat4x2.cpp index 83a69d405..989acee15 100644 --- a/test/core/core_type_mat4x2.cpp +++ b/test/core/core_type_mat4x2.cpp @@ -9,7 +9,7 @@ #include -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; } diff --git a/test/core/core_type_mat4x3.cpp b/test/core/core_type_mat4x3.cpp index 893b67a44..cc46e8d49 100644 --- a/test/core/core_type_mat4x3.cpp +++ b/test/core/core_type_mat4x3.cpp @@ -9,7 +9,7 @@ #include -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; } diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index a821b91a6..7028d2804 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/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; } diff --git a/test/core/core_type_vec1.cpp b/test/core/core_type_vec1.cpp index 9d31fcddd..fddd6a47f 100644 --- a/test/core/core_type_vec1.cpp +++ b/test/core/core_type_vec1.cpp @@ -9,22 +9,21 @@ #include -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; } diff --git a/test/core/core_type_vec2.cpp b/test/core/core_type_vec2.cpp index ab9db6890..00c48a99d 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -9,22 +9,21 @@ #include -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; } diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index 5b2f20f1b..a2b7ec490 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -9,22 +9,21 @@ #include -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; } diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 2edb46452..dd0769bb3 100644 --- a/test/core/core_type_vec4.cpp +++ b/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(A); //glm::vec4 B = glm::detail::tvec##(glm::vec4::_size)(); - 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(glm::vec4(1.0f, 2.0f, 3.0f, 4.0f)); //__m128 DataB = swizzle(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; } diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index 0b9bc9088..c018ae682 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -13,7 +13,7 @@ int main() { - int Failed = 0; + int Error = -1; - return Failed; + return Error; } diff --git a/test/gtx/gtx-bit.cpp b/test/gtx/gtx-bit.cpp index 99bb586f7..7133b60fb 100644 --- a/test/gtx/gtx-bit.cpp +++ b/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; } diff --git a/test/gtx/gtx-simd-vec4.cpp b/test/gtx/gtx-simd-vec4.cpp index d5df3ada9..4dd853669 100644 --- a/test/gtx/gtx-simd-vec4.cpp +++ b/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::simdVec4 D1 = A1.swizzle(); glm::simdVec4 E1(glm::vec4(1.0f)); glm::vec4 F1 = glm::vec4_cast(E1); //glm::vec4 G1(E1);