From aa4f5601765bbe08a44fd6118becae701e875121 Mon Sep 17 00:00:00 2001 From: Owen Green Date: Wed, 17 Jul 2024 17:03:25 +0100 Subject: [PATCH] TestFluidTensor: Remove dodgy calls to `cols()` on 1D tensor (were causing crashes) --- tests/data/TestFluidTensor.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/data/TestFluidTensor.cpp b/tests/data/TestFluidTensor.cpp index d7f553f5d..932c7b99c 100644 --- a/tests/data/TestFluidTensor.cpp +++ b/tests/data/TestFluidTensor.cpp @@ -20,7 +20,7 @@ TEST_CASE("FluidTensor can be created from a list of dimenions","[FluidTensor]") REQUIRE(x.size() == 3); REQUIRE(x.rows() == 3); - REQUIRE(x.cols() == 1); + // REQUIRE(x.cols() == 1); REQUIRE(std::distance(x.begin(),x.end()) == x.size()); } SECTION("2D creation reports correct sizes"){ @@ -31,15 +31,15 @@ TEST_CASE("FluidTensor can be created from a list of dimenions","[FluidTensor]") REQUIRE(x.cols() == 2); REQUIRE(std::distance(x.begin(),x.end()) == x.size()); } - // SECTION("3D creation reports correct sizes"){ - // const FluidTensor x(fluid::FluidDefaultAllocator(), 3,2,5); + SECTION("3D creation reports correct sizes"){ + const FluidTensor x(3,2,5); - // REQUIRE(x.size() == (3 * 2 * 5)); - // REQUIRE(x.rows() == 3); - // REQUIRE(x.cols() == 2); - // REQUIRE(x.descriptor().extents[2] == 5); - // REQUIRE(std::distance(x.begin(),x.end()) == x.size()); - // } + REQUIRE(x.size() == (3 * 2 * 5)); + REQUIRE(x.rows() == 3); + REQUIRE(x.cols() == 2); + REQUIRE(x.descriptor().extents[2] == 5); + REQUIRE(std::distance(x.begin(),x.end()) == x.size()); + } } TEST_CASE("FluidTensor can be initialized from initializer lists","[FluidTensor]"){ @@ -62,7 +62,7 @@ TEST_CASE("FluidTensor can be initialized from initializer lists","[FluidTensor] 4}; const std::array y{0,1,2,3,4}; REQUIRE(x.rows() == 5); - REQUIRE(x.cols() == 1); + // REQUIRE(x.cols() == 1); REQUIRE(std::distance(x.begin(),x.end()) == x.size()); REQUIRE(std::equal(x.begin(),x.end(), y.begin())); }