1 #include "GLTraitsTest.hpp"
3 #include "graphics/gl_traits.hpp"
5 CPPUNIT_TEST_SUITE_REGISTRATION(blank::test::GLTraitsTest);
11 void GLTraitsTest::setUp() {
15 void GLTraitsTest::tearDown() {
20 void GLTraitsTest::testSize() {
21 CPPUNIT_ASSERT_EQUAL_MESSAGE(
22 "bad number of components for byte",
23 1, gl_traits<signed char>::size
25 CPPUNIT_ASSERT_EQUAL_MESSAGE(
26 "bad number of components for ubyte",
27 1, gl_traits<unsigned char>::size
29 CPPUNIT_ASSERT_EQUAL_MESSAGE(
30 "bad number of components for short",
31 1, gl_traits<short>::size
33 CPPUNIT_ASSERT_EQUAL_MESSAGE(
34 "bad number of components for ushort",
35 1, gl_traits<unsigned short>::size
37 CPPUNIT_ASSERT_EQUAL_MESSAGE(
38 "bad number of components for int",
39 1, gl_traits<int>::size
41 CPPUNIT_ASSERT_EQUAL_MESSAGE(
42 "bad number of components for uint",
43 1, gl_traits<unsigned int>::size
45 CPPUNIT_ASSERT_EQUAL_MESSAGE(
46 "bad number of components for float",
47 1, gl_traits<float>::size
49 CPPUNIT_ASSERT_EQUAL_MESSAGE(
50 "bad number of components for double",
51 1, gl_traits<double>::size
54 CPPUNIT_ASSERT_EQUAL_MESSAGE(
55 "bad number of components for vec2",
56 2, gl_traits<glm::vec2>::size
58 CPPUNIT_ASSERT_EQUAL_MESSAGE(
59 "bad number of components for vec3",
60 3, gl_traits<glm::vec3>::size
62 CPPUNIT_ASSERT_EQUAL_MESSAGE(
63 "bad number of components for vec4",
64 4, gl_traits<glm::vec4>::size
67 CPPUNIT_ASSERT_EQUAL_MESSAGE(
68 "bad number of components for vec2i",
69 2, gl_traits<glm::ivec2>::size
71 CPPUNIT_ASSERT_EQUAL_MESSAGE(
72 "bad number of components for vec3i",
73 3, gl_traits<glm::ivec3>::size
75 CPPUNIT_ASSERT_EQUAL_MESSAGE(
76 "bad number of components for vec4i",
77 4, gl_traits<glm::ivec4>::size
81 void GLTraitsTest::testType() {
82 CPPUNIT_ASSERT_EQUAL_MESSAGE(
83 "bad component type for byte",
84 GLenum(GL_BYTE), gl_traits<signed char>::type
86 CPPUNIT_ASSERT_EQUAL_MESSAGE(
87 "bad component type for ubyte",
88 GLenum(GL_UNSIGNED_BYTE), gl_traits<unsigned char>::type
90 CPPUNIT_ASSERT_EQUAL_MESSAGE(
91 "bad component type for short",
92 GLenum(GL_SHORT), gl_traits<short>::type
94 CPPUNIT_ASSERT_EQUAL_MESSAGE(
95 "bad component type for ushort",
96 GLenum(GL_UNSIGNED_SHORT), gl_traits<unsigned short>::type
98 CPPUNIT_ASSERT_EQUAL_MESSAGE(
99 "bad component type for int",
100 GLenum(GL_INT), gl_traits<int>::type
102 CPPUNIT_ASSERT_EQUAL_MESSAGE(
103 "bad component type for uint",
104 GLenum(GL_UNSIGNED_INT), gl_traits<unsigned int>::type
106 CPPUNIT_ASSERT_EQUAL_MESSAGE(
107 "bad component type for float",
108 GLenum(GL_FLOAT), gl_traits<float>::type
110 CPPUNIT_ASSERT_EQUAL_MESSAGE(
111 "bad component type for double",
112 GLenum(GL_DOUBLE), gl_traits<double>::type
115 CPPUNIT_ASSERT_EQUAL_MESSAGE(
116 "bad component type for vec2",
117 GLenum(GL_FLOAT), gl_traits<glm::vec2>::type
119 CPPUNIT_ASSERT_EQUAL_MESSAGE(
120 "bad component type for vec3",
121 GLenum(GL_FLOAT), gl_traits<glm::vec3>::type
123 CPPUNIT_ASSERT_EQUAL_MESSAGE(
124 "bad component type for vec4",
125 GLenum(GL_FLOAT), gl_traits<glm::vec4>::type
128 CPPUNIT_ASSERT_EQUAL_MESSAGE(
129 "bad component type for vec2i",
130 GLenum(GL_INT), gl_traits<glm::tvec2<int>>::type
132 CPPUNIT_ASSERT_EQUAL_MESSAGE(
133 "bad component type for vec3i",
134 GLenum(GL_INT), gl_traits<glm::tvec3<int>>::type
136 CPPUNIT_ASSERT_EQUAL_MESSAGE(
137 "bad component type for vec4i",
138 GLenum(GL_INT), gl_traits<glm::tvec4<int>>::type