]> git.localhorst.tv Git - blank.git/blob - tst/graphics/GLTraitsTest.cpp
(shabby) client side handling of messages
[blank.git] / tst / graphics / GLTraitsTest.cpp
1 #include "GLTraitsTest.hpp"
2
3 #include "graphics/gl_traits.hpp"
4
5 CPPUNIT_TEST_SUITE_REGISTRATION(blank::test::GLTraitsTest);
6
7
8 namespace blank {
9 namespace test {
10
11 void GLTraitsTest::setUp() {
12
13 }
14
15 void GLTraitsTest::tearDown() {
16
17 }
18
19
20 void GLTraitsTest::testSize() {
21         CPPUNIT_ASSERT_EQUAL_MESSAGE(
22                 "bad number of components for byte",
23                 1, gl_traits<signed char>::size
24         );
25         CPPUNIT_ASSERT_EQUAL_MESSAGE(
26                 "bad number of components for ubyte",
27                 1, gl_traits<unsigned char>::size
28         );
29         CPPUNIT_ASSERT_EQUAL_MESSAGE(
30                 "bad number of components for short",
31                 1, gl_traits<short>::size
32         );
33         CPPUNIT_ASSERT_EQUAL_MESSAGE(
34                 "bad number of components for ushort",
35                 1, gl_traits<unsigned short>::size
36         );
37         CPPUNIT_ASSERT_EQUAL_MESSAGE(
38                 "bad number of components for int",
39                 1, gl_traits<int>::size
40         );
41         CPPUNIT_ASSERT_EQUAL_MESSAGE(
42                 "bad number of components for uint",
43                 1, gl_traits<unsigned int>::size
44         );
45         CPPUNIT_ASSERT_EQUAL_MESSAGE(
46                 "bad number of components for float",
47                 1, gl_traits<float>::size
48         );
49         CPPUNIT_ASSERT_EQUAL_MESSAGE(
50                 "bad number of components for double",
51                 1, gl_traits<double>::size
52         );
53
54         CPPUNIT_ASSERT_EQUAL_MESSAGE(
55                 "bad number of components for vec2",
56                 2, gl_traits<glm::vec2>::size
57         );
58         CPPUNIT_ASSERT_EQUAL_MESSAGE(
59                 "bad number of components for vec3",
60                 3, gl_traits<glm::vec3>::size
61         );
62         CPPUNIT_ASSERT_EQUAL_MESSAGE(
63                 "bad number of components for vec4",
64                 4, gl_traits<glm::vec4>::size
65         );
66
67         CPPUNIT_ASSERT_EQUAL_MESSAGE(
68                 "bad number of components for vec2i",
69                 2, gl_traits<glm::ivec2>::size
70         );
71         CPPUNIT_ASSERT_EQUAL_MESSAGE(
72                 "bad number of components for vec3i",
73                 3, gl_traits<glm::ivec3>::size
74         );
75         CPPUNIT_ASSERT_EQUAL_MESSAGE(
76                 "bad number of components for vec4i",
77                 4, gl_traits<glm::ivec4>::size
78         );
79 }
80
81 void GLTraitsTest::testType() {
82         CPPUNIT_ASSERT_EQUAL_MESSAGE(
83                 "bad component type for byte",
84                 GLenum(GL_BYTE), gl_traits<signed char>::type
85         );
86         CPPUNIT_ASSERT_EQUAL_MESSAGE(
87                 "bad component type for ubyte",
88                 GLenum(GL_UNSIGNED_BYTE), gl_traits<unsigned char>::type
89         );
90         CPPUNIT_ASSERT_EQUAL_MESSAGE(
91                 "bad component type for short",
92                 GLenum(GL_SHORT), gl_traits<short>::type
93         );
94         CPPUNIT_ASSERT_EQUAL_MESSAGE(
95                 "bad component type for ushort",
96                 GLenum(GL_UNSIGNED_SHORT), gl_traits<unsigned short>::type
97         );
98         CPPUNIT_ASSERT_EQUAL_MESSAGE(
99                 "bad component type for int",
100                 GLenum(GL_INT), gl_traits<int>::type
101         );
102         CPPUNIT_ASSERT_EQUAL_MESSAGE(
103                 "bad component type for uint",
104                 GLenum(GL_UNSIGNED_INT), gl_traits<unsigned int>::type
105         );
106         CPPUNIT_ASSERT_EQUAL_MESSAGE(
107                 "bad component type for float",
108                 GLenum(GL_FLOAT), gl_traits<float>::type
109         );
110         CPPUNIT_ASSERT_EQUAL_MESSAGE(
111                 "bad component type for double",
112                 GLenum(GL_DOUBLE), gl_traits<double>::type
113         );
114
115         CPPUNIT_ASSERT_EQUAL_MESSAGE(
116                 "bad component type for vec2",
117                 GLenum(GL_FLOAT), gl_traits<glm::vec2>::type
118         );
119         CPPUNIT_ASSERT_EQUAL_MESSAGE(
120                 "bad component type for vec3",
121                 GLenum(GL_FLOAT), gl_traits<glm::vec3>::type
122         );
123         CPPUNIT_ASSERT_EQUAL_MESSAGE(
124                 "bad component type for vec4",
125                 GLenum(GL_FLOAT), gl_traits<glm::vec4>::type
126         );
127
128         CPPUNIT_ASSERT_EQUAL_MESSAGE(
129                 "bad component type for vec2i",
130                 GLenum(GL_INT), gl_traits<glm::tvec2<int>>::type
131         );
132         CPPUNIT_ASSERT_EQUAL_MESSAGE(
133                 "bad component type for vec3i",
134                 GLenum(GL_INT), gl_traits<glm::tvec3<int>>::type
135         );
136         CPPUNIT_ASSERT_EQUAL_MESSAGE(
137                 "bad component type for vec4i",
138                 GLenum(GL_INT), gl_traits<glm::tvec4<int>>::type
139         );
140 }
141
142 }
143 }