Skip to content

Commit

Permalink
Fixed slice tests
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Dafarra committed Dec 20, 2024
1 parent 477ef0c commit 747dc32
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/ExogenousConversionsUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,29 +111,29 @@ TEST_CASE("Eigen Conversions")


expectedSlice.resize(2,3);
expectedSlice << 2.0, 7.0, 10.0,
expectedSlice << 2.0, 6.0, 10.0,
4.0, 8.0, 12.0;
expectedSlice.isApprox(matioCpp::to_eigen(matioCppMatrix2, {1, -1, -1 }), 1e-5);
REQUIRE(expectedSlice.isApprox(matioCpp::to_eigen(matioCppMatrix2, {1, -1, -1 }), 1e-5));

expectedSlice.resize(2, 3);
expectedSlice << 3.0, 6.0, 11.0,
expectedSlice << 3.0, 7.0, 11.0,
4.0, 8.0, 12.0;
expectedSlice.isApprox(matioCpp::to_eigen(matioCppMatrix2, { -1, 1, -1 }), 1e-5);
REQUIRE(expectedSlice.isApprox(matioCpp::to_eigen(matioCppMatrix2, { -1, 1, -1 }), 1e-5));

expectedSlice.resize(2, 1);
expectedSlice << 11.0,
12.0;
expectedSlice.isApprox(matioCpp::to_eigen(matioCppMatrix2, { -1, 1, 2 }), 1e-5);
REQUIRE(expectedSlice.isApprox(matioCpp::to_eigen(matioCppMatrix2, { -1, 1, 2 }), 1e-5));

expectedSlice.resize(1, 1);
expectedSlice << 8.0;
expectedSlice.isApprox(matioCpp::to_eigen(matioCppMatrix2, { 1, 1, 1 }), 1e-5);
REQUIRE(expectedSlice.isApprox(matioCpp::to_eigen(matioCppMatrix2, { 1, 1, 1 }), 1e-5));

const auto& constMatioCppMatrix2 = matioCppMatrix2;
expectedSlice.resize(2, 3);
expectedSlice << 1.0, 5.0, 9.0,
3.0, 6.0, 11.0;
expectedSlice.isApprox(matioCpp::to_eigen(constMatioCppMatrix2, { 0, -1, -1 }), 1e-5);
3.0, 7.0, 11.0;
REQUIRE(expectedSlice.isApprox(matioCpp::to_eigen(constMatioCppMatrix2, { 0, -1, -1 }), 1e-5));

}

Expand Down

0 comments on commit 747dc32

Please sign in to comment.