Added Ubuntu 24.04 tests

Co-authored-by: Jules Pénuchot <jules@penuchot.com>

See merge request oss/rotgen!33
This commit is contained in:
Jules Pénuchot 2025-10-06 17:03:54 +02:00 committed by Joel Falcou
parent 8fcd92ce1a
commit 991967761d
6 changed files with 254 additions and 142 deletions

View file

@ -8,19 +8,23 @@
#include "unit/tests.hpp"
#include <rotgen/rotgen.hpp>
// Helper: fill matrix from raw data
// NB: This function must not be turned into a lambda, otherwise
// `test-ubuntu-gcc-release` will not pass and the CI will fail.
// This is likely due to a compilation bug from GCC 13.3.0.
void fill(auto &m, int r, int c, auto data[]) {
for (int k = 0; k < r * c; ++k)
m.data()[k] = data[k];
}
TTS_CASE_TPL("Function size", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
T data[] = {1,2,3,4,5,6,7,8,9,10,11,12};
// Helper: fill matrix from raw data
auto fill = [&](auto& m, int r, int c) {
for(int k = 0; k < r * c; ++k) m.data()[k] = data[k];
};
// 1x12 dynamic block at (0,0)
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value> dm(1,12);
fill(dm,1,12);
fill(dm,1,12,data);
auto b1 = rotgen::block<decltype(dm), rotgen::Dynamic, rotgen::Dynamic>(dm, 0,0,1,12);
TTS_EQUAL(b1.rows(), rotgen::Index{1});
TTS_EQUAL(b1.cols(), rotgen::Index{12});
@ -32,7 +36,7 @@ TTS_CASE_TPL("Function size", rotgen::tests::types)
// 3x2 dynamic block at (1,4) in 4x6
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value> dm2(4,6);
fill(dm2,4,6);
fill(dm2,4,6,data);
auto b3 = rotgen::block<decltype(dm2), rotgen::Dynamic, rotgen::Dynamic>(dm2, 1,4,3,2);
TTS_EQUAL(b3.rows(), rotgen::Index{3});
TTS_EQUAL(b3.cols(), rotgen::Index{2});
@ -40,7 +44,7 @@ TTS_CASE_TPL("Function size", rotgen::tests::types)
// 3x4 static block
rotgen::matrix<T,3,4,O::value> sm;
fill(sm,3,4);
fill(sm,3,4,data);
auto b4 = rotgen::block<decltype(sm), 3, 4>(sm, 0,0);
TTS_EQUAL(b4.rows(), rotgen::Index{3});
TTS_EQUAL(b4.cols(), rotgen::Index{4});
@ -48,7 +52,7 @@ TTS_CASE_TPL("Function size", rotgen::tests::types)
// 6x2 static block
rotgen::matrix<T,6,2,O::value> sm2;
fill(sm2,6,2);
fill(sm2,6,2,data);
auto b5 = rotgen::block<decltype(sm2), 6, 2>(sm2, 0,0);
TTS_EQUAL(b5.rows(), rotgen::Index{6});
TTS_EQUAL(b5.cols(), rotgen::Index{2});