Browse Source

Added more initializer lists tests

Christophe Riccio 12 years ago
parent
commit
2d5724e23a
3 changed files with 100 additions and 2 deletions
  1. 46 1
      test/core/core_type_mat2x2.cpp
  2. 53 0
      test/core/core_type_mat4x2.cpp
  3. 1 1
      test/core/core_type_vec4.cpp

+ 46 - 1
test/core/core_type_mat2x2.cpp

@@ -7,8 +7,10 @@
 // File    : test/core/type_mat2x2.cpp
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-#include <glm/core/type_mat2x2.hpp>
 #include <glm/gtc/epsilon.hpp>
+#include <glm/core/func_vector_relational.hpp>
+#include <glm/core/type_mat2x2.hpp>
+#include <vector>
 
 int test_operators()
 {
@@ -53,10 +55,53 @@ int test_inverse()
 	return Error;
 }
 
+int test_ctr()
+{
+	int Error(0);
+
+#if(GLM_HAS_INITIALIZER_LISTS)
+	glm::mat2x2 m0(
+		glm::vec2(0, 1), 
+		glm::vec2(2, 3));
+
+	glm::mat2x2 m1{0, 1, 2, 3};
+
+	glm::mat2x2 m2{
+		{0, 1},
+		{2, 3}};
+
+	for(int i = 0; i < m0.length(); ++i)
+		Error += glm::all(glm::equal(m0[i], m2[i])) ? 0 : 1;
+
+	for(int i = 0; i < m1.length(); ++i)
+		Error += glm::all(glm::equal(m1[i], m2[i])) ? 0 : 1;
+
+	std::vector<glm::mat2x2> v1{
+		{0, 1, 2, 3},
+		{0, 1, 2, 3}
+	};
+
+	std::vector<glm::mat2x2> v2{
+		{
+			{ 0, 1},
+			{ 4, 5}
+		},
+		{
+			{ 0, 1},
+			{ 4, 5}
+		}
+	};
+
+#endif//GLM_HAS_INITIALIZER_LISTS
+
+	return Error;
+}
+
 int main()
 {
 	int Error(0);
 
+	Error += test_ctr();
 	Error += test_operators();
 	Error += test_inverse();
 

+ 53 - 0
test/core/core_type_mat4x2.cpp

@@ -7,7 +7,9 @@
 // File    : test/core/type_mat4x2.cpp
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
+#include <glm/core/func_vector_relational.hpp>
 #include <glm/core/type_mat4x2.hpp>
+#include <vector>
 
 static int test_operators()
 {
@@ -28,10 +30,61 @@ static int test_operators()
 	return (S && !R) ? 0 : 1;
 }
 
+int test_ctr()
+{
+	int Error(0);
+
+#if(GLM_HAS_INITIALIZER_LISTS)
+	glm::mat4x2 m0(
+		glm::vec2(0, 1), 
+		glm::vec2(2, 3),
+		glm::vec2(4, 5),
+		glm::vec2(6, 7));
+
+	glm::mat4x2 m1{0, 1, 2, 3, 4, 5, 6, 7};
+
+	glm::mat4x2 m2{
+		{0, 1},
+		{2, 3},
+		{4, 5},
+		{6, 7}};
+
+	for(int i = 0; i < m0.length(); ++i)
+		Error += glm::all(glm::equal(m0[i], m2[i])) ? 0 : 1;
+
+	for(int i = 0; i < m1.length(); ++i)
+		Error += glm::all(glm::equal(m1[i], m2[i])) ? 0 : 1;
+
+	std::vector<glm::mat4x2> v1{
+		{0, 1, 2, 3, 4, 5, 6, 7},
+		{0, 1, 2, 3, 4, 5, 6, 7}
+	};
+
+	std::vector<glm::mat4x2> v2{
+		{
+			{ 0, 1},
+			{ 4, 5},
+			{ 8, 9},
+			{ 12, 13}
+		},
+		{
+			{ 0, 1},
+			{ 4, 5},
+			{ 8, 9},
+			{ 12, 13}
+		}
+	};
+
+#endif//GLM_HAS_INITIALIZER_LISTS
+
+	return Error;
+}
+
 int main()
 {
 	int Error = 0;
 
+	Error += test_ctr();
 	Error += test_operators();
 
 	return Error;

+ 1 - 1
test/core/core_type_vec4.cpp

@@ -368,7 +368,7 @@ int main()
 
 	int Error(0);
 	
-	std::size_t const Size(100000000);
+	std::size_t const Size(1000000);
 
 	Error += test_vec4_perf_AoS(Size);
 	Error += test_vec4_perf_SoA(Size);