// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. /////////////////////////////////////////////////////////////////////////////// #include <Hect/Graphics/VertexAttribute.h> using namespace hect; #include <catch.hpp> TEST_CASE("Construct a vertex attribute", "[VertexAttribute]") { VertexAttribute attribute(VertexAttributeSemantic::Position, VertexAttributeType::Float32, 3); REQUIRE(VertexAttributeSemantic::Position == attribute.semantic()); REQUIRE(VertexAttributeType::Float32 == attribute.type()); REQUIRE(attribute.cardinality() == 3u); } TEST_CASE("Compute the size of a vertex attribute", "[VertexAttribute]") { VertexAttribute attribute(VertexAttributeSemantic::Position, VertexAttributeType::Int16, 3); REQUIRE(attribute.size() == 2u * 3u); attribute = VertexAttribute(VertexAttributeSemantic::Position, VertexAttributeType::Float32, 3); REQUIRE(attribute.size() == 4u * 3u); attribute = VertexAttribute(VertexAttributeSemantic::Position, VertexAttributeType::Float32, 2); REQUIRE(attribute.size() == 4u * 2u); }