Testing functional API only (oss/rotgen#17)
Co-authored-by: Jules Pénuchot <jules@penuchot.com> See merge request oss/rotgen!42
This commit is contained in:
parent
6fa95fb22d
commit
4a7aa08cdb
11 changed files with 192 additions and 192 deletions
|
|
@ -33,14 +33,14 @@ TTS_CASE_TPL("Resizing dynamic matrix",
|
|||
for (rotgen::Index r = 0; r < a.rows(); ++r)
|
||||
for (rotgen::Index c = 0; c < a.cols(); ++c) a(r, c) = 42 + 2 * c + r;
|
||||
|
||||
a.resize(3, 2);
|
||||
rotgen::resize(a, 3, 2);
|
||||
TTS_EQUAL(a.rows(), rotgen::Index(3));
|
||||
TTS_EQUAL(a.cols(), rotgen::Index(2));
|
||||
|
||||
for (rotgen::Index r = 0; r < a.rows(); ++r)
|
||||
for (rotgen::Index c = 0; c < a.cols(); ++c) TTS_GREATER(a(r, c), 0);
|
||||
|
||||
a.resize(2, 2);
|
||||
rotgen::resize(a, 2, 2);
|
||||
TTS_EQUAL(a.rows(), rotgen::Index(2));
|
||||
TTS_EQUAL(a.cols(), rotgen::Index(2));
|
||||
};
|
||||
|
|
@ -55,7 +55,7 @@ TTS_CASE_TPL("Dynamix matrix conservative resizing",
|
|||
for (rotgen::Index r = 0; r < a.rows(); ++r)
|
||||
for (rotgen::Index c = 0; c < a.cols(); ++c) a(r, c) = i++;
|
||||
|
||||
a.conservativeResize(2, 3);
|
||||
rotgen::conservativeResize(a, 2, 3);
|
||||
TTS_EQUAL(a.rows(), rotgen::Index(2));
|
||||
TTS_EQUAL(a.cols(), rotgen::Index(3));
|
||||
|
||||
|
|
@ -63,36 +63,36 @@ TTS_CASE_TPL("Dynamix matrix conservative resizing",
|
|||
for (rotgen::Index r = 0; r < a.rows(); ++r)
|
||||
for (rotgen::Index c = 0; c < a.cols(); ++c) TTS_EQUAL(a(r, c), i++);
|
||||
|
||||
a.conservativeResize(3, 2);
|
||||
rotgen::conservativeResize(a, 3, 2);
|
||||
TTS_EQUAL(a.rows(), rotgen::Index(3));
|
||||
TTS_EQUAL(a.cols(), rotgen::Index(2));
|
||||
int expected[3][2] = {{1, 2}, {4, 5}};
|
||||
for (rotgen::Index r = 0; r < 2; ++r)
|
||||
for (rotgen::Index c = 0; c < 2; ++c) TTS_EQUAL(a(r, c), expected[r][c]);
|
||||
|
||||
a.conservativeResize(4, 4);
|
||||
rotgen::conservativeResize(a, 4, 4);
|
||||
TTS_EQUAL(a.rows(), rotgen::Index(4));
|
||||
TTS_EQUAL(a.cols(), rotgen::Index(4));
|
||||
TTS_EQUAL(a(0, 0), 1);
|
||||
TTS_EQUAL(a(3, 3), 0);
|
||||
|
||||
a.conservativeResize(2, 2);
|
||||
rotgen::conservativeResize(a, 2, 2);
|
||||
TTS_EQUAL(a.rows(), rotgen::Index(2));
|
||||
TTS_EQUAL(a.cols(), rotgen::Index(2));
|
||||
TTS_EQUAL(a(0, 0), 1);
|
||||
TTS_EQUAL(a(1, 1), 5);
|
||||
|
||||
a.conservativeResize(1, 2);
|
||||
rotgen::conservativeResize(a, 1, 2);
|
||||
TTS_EQUAL(a.rows(), rotgen::Index(1));
|
||||
TTS_EQUAL(a.cols(), rotgen::Index(2));
|
||||
TTS_EQUAL(a(0, 0), 1);
|
||||
TTS_EQUAL(a(0, 1), 2);
|
||||
|
||||
a.conservativeResize(0, 0);
|
||||
rotgen::conservativeResize(a, 0, 0);
|
||||
TTS_EQUAL(a.rows(), rotgen::Index(0));
|
||||
TTS_EQUAL(a.cols(), rotgen::Index(0));
|
||||
|
||||
a.conservativeResize(3, 3);
|
||||
rotgen::conservativeResize(a, 3, 3);
|
||||
TTS_EQUAL(a.rows(), rotgen::Index(3));
|
||||
TTS_EQUAL(a.cols(), rotgen::Index(3));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@
|
|||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/arithmetic.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/common/arithmetic.hpp"
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
TTS_CASE_TPL("Test dynamic matrix inverse",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue