Implement fixed size options for rotgen containers

See merge request oss/rotgen!11
This commit is contained in:
Joel Falcou 2025-07-20 20:23:51 +02:00
parent 8e545dd51a
commit 2084874b1b
39 changed files with 1247 additions and 323 deletions

View file

@ -6,10 +6,11 @@
*/
//==================================================================================================
#include "unit/tests.hpp"
#include <rotgen/matrix.hpp>
#include <rotgen/rotgen.hpp>
void test_value(const auto& matrix, std::size_t rows, std::size_t cols, auto constant)
{
TTS_EXPECT(verify_rotgen_reentrance(matrix));
for(std::size_t r=0;r<rows;++r)
for(std::size_t c=0;c<cols;++c)
TTS_EQUAL(matrix(r, c), constant);
@ -17,6 +18,7 @@ void test_value(const auto& matrix, std::size_t rows, std::size_t cols, auto con
void test_random(const auto& matrix, std::size_t rows, std::size_t cols)
{
TTS_EXPECT(verify_rotgen_reentrance(matrix));
for(std::size_t r=0;r<rows;++r)
for(std::size_t c=0;c<cols;++c)
{
@ -27,6 +29,7 @@ void test_random(const auto& matrix, std::size_t rows, std::size_t cols)
void test_identity(const auto& matrix, std::size_t rows, std::size_t cols)
{
TTS_EXPECT(verify_rotgen_reentrance(matrix));
for(std::size_t r=0;r<rows;++r)
for(std::size_t c=0;c<cols;++c)
TTS_EQUAL(matrix(r, c), r==c ? 1 : 0);