X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=tst%2Fgraphics%2FGLTraitsTest.cpp;fp=tst%2Fgraphics%2FGLTraitsTest.cpp;h=956733153eb12308534bfc0b55a9bfdbd0ef4344;hb=5998b18978bd8e7a0c9deb516474634e1d3521c9;hp=0000000000000000000000000000000000000000;hpb=7c2a8b8285278b8a3077b311d82f05ea0463a96e;p=blank.git diff --git a/tst/graphics/GLTraitsTest.cpp b/tst/graphics/GLTraitsTest.cpp new file mode 100644 index 0000000..9567331 --- /dev/null +++ b/tst/graphics/GLTraitsTest.cpp @@ -0,0 +1,143 @@ +#include "GLTraitsTest.hpp" + +#include "graphics/gl_traits.hpp" + +CPPUNIT_TEST_SUITE_REGISTRATION(blank::test::GLTraitsTest); + + +namespace blank { +namespace test { + +void GLTraitsTest::setUp() { + +} + +void GLTraitsTest::tearDown() { + +} + + +void GLTraitsTest::testSize() { + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for byte", + 1, gl_traits::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for ubyte", + 1, gl_traits::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for short", + 1, gl_traits::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for ushort", + 1, gl_traits::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for int", + 1, gl_traits::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for uint", + 1, gl_traits::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for float", + 1, gl_traits::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for double", + 1, gl_traits::size + ); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for vec2", + 2, gl_traits::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for vec3", + 3, gl_traits::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for vec4", + 4, gl_traits::size + ); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for vec2i", + 2, gl_traits>::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for vec3i", + 3, gl_traits>::size + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad number of components for vec4i", + 4, gl_traits>::size + ); +} + +void GLTraitsTest::testType() { + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for byte", + GLenum(GL_BYTE), gl_traits::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for ubyte", + GLenum(GL_UNSIGNED_BYTE), gl_traits::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for short", + GLenum(GL_SHORT), gl_traits::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for ushort", + GLenum(GL_UNSIGNED_SHORT), gl_traits::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for int", + GLenum(GL_INT), gl_traits::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for uint", + GLenum(GL_UNSIGNED_INT), gl_traits::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for float", + GLenum(GL_FLOAT), gl_traits::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for double", + GLenum(GL_DOUBLE), gl_traits::type + ); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for vec2", + GLenum(GL_FLOAT), gl_traits::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for vec3", + GLenum(GL_FLOAT), gl_traits::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for vec4", + GLenum(GL_FLOAT), gl_traits::type + ); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for vec2i", + GLenum(GL_INT), gl_traits>::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for vec3i", + GLenum(GL_INT), gl_traits>::type + ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "bad component type for vec4i", + GLenum(GL_INT), gl_traits>::type + ); +} + +} +}