void CompressIndicesTest::compressChar() { std::size_t indexCount; Mesh::IndexType indexType; Containers::Array<char> data; std::tie(indexCount, indexType, data) = MeshTools::compressIndices( std::vector<UnsignedInt>{1, 2, 3, 0, 4}); CORRADE_COMPARE(indexCount, 5); CORRADE_VERIFY(indexType == Mesh::IndexType::UnsignedByte); CORRADE_COMPARE(std::vector<char>(data.begin(), data.end()), (std::vector<char>{ 0x01, 0x02, 0x03, 0x00, 0x04 })); }
void CompressIndicesTest::compressInt() { std::size_t indexCount; Mesh::IndexType indexType; Containers::Array<char> data; std::tie(indexCount, indexType, data) = MeshTools::compressIndices( std::vector<UnsignedInt>{65536, 3, 2}); CORRADE_COMPARE(indexCount, 3); CORRADE_VERIFY(indexType == Mesh::IndexType::UnsignedInt); if(!Utility::Endianness::isBigEndian()) { CORRADE_COMPARE(std::vector<char>(data.begin(), data.end()), (std::vector<char>{ 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 })); } else { CORRADE_COMPARE(std::vector<char>(data.begin(), data.end()), (std::vector<char>{ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02 })); } }