Browse Source

Added half type tests

Christophe Riccio 14 years ago
parent
commit
6ff27ec9f9
1 changed files with 51 additions and 6 deletions
  1. 51 6
      test/gtc/gtc_half_float.cpp

+ 51 - 6
test/gtc/gtc_half_float.cpp

@@ -1,18 +1,63 @@
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// Created : 2010-09-16
-// Updated : 2010-09-16
+// Created : 2011-05-32
+// Updated : 2011-05-32
 // Licence : This source is under MIT licence
-// File    : test/gtc/matrix_transform.cpp
+// File    : test/gtc/half_float.cpp
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #include <glm/glm.hpp>
-#include <glm/gtc/matrix_transform.hpp>
+#include <glm/gtc/half_float.hpp>
+
+int test_half_precision_scalar()
+{
+	int Error = 0;
+
+	Error += sizeof(glm::half) == 2 ? 0 : 1;
+
+	return Error;
+}
+
+int test_half_precision_vec()
+{
+	int Error = 0;
+
+	Error += sizeof(glm::hvec2) == 4 ? 0 : 1;
+	Error += sizeof(glm::hvec3) == 6 ? 0 : 1;
+	Error += sizeof(glm::hvec4) == 8 ? 0 : 1;
+    
+    return Error;
+}
+
+int test_half_precision_mat()
+{
+	int Error = 0;
+
+	Error += sizeof(glm::hmat2) == 8 ? 0 : 1;
+	Error += sizeof(glm::hmat3) == 18 ? 0 : 1;
+	Error += sizeof(glm::hmat4) == 32 ? 0 : 1;
+
+	Error += sizeof(glm::hmat2x2) == 8 ? 0 : 1;
+	Error += sizeof(glm::hmat2x3) == 12 ? 0 : 1;
+	Error += sizeof(glm::hmat2x4) == 16 ? 0 : 1;
+	Error += sizeof(glm::hmat3x2) == 12 ? 0 : 1;
+	Error += sizeof(glm::hmat3x3) == 18 ? 0 : 1;
+	Error += sizeof(glm::hmat3x4) == 24 ? 0 : 1;
+	Error += sizeof(glm::hmat4x2) == 16 ? 0 : 1;
+	Error += sizeof(glm::hmat4x3) == 24 ? 0 : 1;
+	Error += sizeof(glm::hmat4x4) == 32 ? 0 : 1;
+
+    return Error;
+}
 
 int main()
 {
-	int Failed = 0;
+	int Error = 0;
+
+	Error += test_half_precision_scalar();
+	Error += test_half_precision_vec();
+	Error += test_half_precision_mat();
 
-	return Failed;
+	return Error;
 }