From 82ffd4aaf3e8136849427e24626a66a12d23453a Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 25 Sep 2011 05:17:30 +0100 Subject: [PATCH] Added binary operator tests --- test/core/core_type_vec3.cpp | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index a7e470e2..fdfc3c8c 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -11,12 +11,35 @@ static int test_vec3_operators() { - glm::vec3 A(1.0f); - glm::vec3 B(1.0f); - bool R = A != B; - bool S = A == B; + int Error = 0; + + { + glm::vec3 A(1.0f); + glm::vec3 B(1.0f); + bool R = A != B; + bool S = A == B; - return (S && !R) ? 0 : 1; + Error += (S && !R) ? 0 : 1; + } + + { + glm::vec3 A(1.0f, 2.0f, 3.0f); + glm::vec3 B(4.0f, 5.0f, 6.0f); + + glm::vec3 C = A + B; + Error += C == glm::vec3(5, 7, 9) ? 0 : 1; + + glm::vec3 D = B - A; + Error += D == glm::vec3(3, 3, 3) ? 0 : 1; + + glm::vec3 E = A * B; + Error += E == glm::vec3(4, 10, 18) ? 0 : 1; + + glm::vec3 F = B / A; + Error += F == glm::vec3(4, 2.5, 2) ? 0 : 1; + } + + return Error; } int test_vec3_size()