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