Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 7eb49fbd authored by David Frank's avatar David Frank Committed by Tobias Lasser
Browse files

Add helper to print type in tests; Remove duplicate function of random...

Add helper to print type in tests; Remove duplicate function of random generation of eigen vectors; Add test, which should fail sanitizer
parent 977cf168
Pipeline #233863 failed with stages
in 27 seconds
...@@ -226,14 +226,15 @@ cuda-memcheck: ...@@ -226,14 +226,15 @@ cuda-memcheck:
- gcc - gcc
- cuda - cuda
sanitize-asan-ubsan: asan-ubsan:
<<: *nightly_job <<: *nightly_job
stage: sanitizer stage: sanitizer
image: $CUDA_IMAGE image: $CUDA_IMAGE
script: script:
- mkdir -p build - mkdir -p build
- cd build - cd build
- cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DELSA_SANITIZER="Address;Undefined" .. - rm -f CMakeCache.txt # remove cache, as we sometimes get the wrong cache
- cmake -GNinja -DELSA_BUILD_CUDA_PROJECTORS=OFF -DCMAKE_BUILD_TYPE=Debug -DELSA_SANITIZER="Address;Undefined" ..
- ninja tests - ninja tests
tags: tags:
- linux - linux
...@@ -241,34 +242,6 @@ sanitize-asan-ubsan: ...@@ -241,34 +242,6 @@ sanitize-asan-ubsan:
- gcc - gcc
- cuda - cuda
sanitize-tsan:
<<: *nightly_job
stage: sanitizer
image: $CUDA_IMAGE
script:
- mkdir -p build
- cd build
- CC=clang CXX=clang cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DELSA_SANITIZER="Thread" ..
- ninja tests
tags:
- linux
- elsa
- cuda
sanitize-memsan:
<<: *nightly_job
stage: sanitizer
image: $CUDA_IMAGE
script:
- mkdir -p build
- cd build
- CC=clang CXX=clang cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DELSA_SANITIZER="Memory" ..
- ninja tests
tags:
- linux
- elsa
- cuda
### test coverage ### ### test coverage ###
......
...@@ -113,8 +113,7 @@ if(ELSA_CUDA_VECTOR) ...@@ -113,8 +113,7 @@ if(ELSA_CUDA_VECTOR)
endif() endif()
endif() endif()
# ------------ Setup Tools -----------
# ------------ setup tools -----------
# ------------ # ------------
# Includes clang-format, clang-tidy, cmake-format, and sanitizers # Includes clang-format, clang-tidy, cmake-format, and sanitizers
...@@ -143,6 +142,7 @@ if(ELSA_TESTING OR ELSA_BENCHMARKS) ...@@ -143,6 +142,7 @@ if(ELSA_TESTING OR ELSA_BENCHMARKS)
add_custom_target(tests add_custom_target(tests
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
USES_TERMINAL
COMMENT "Build and run all the tests.") COMMENT "Build and run all the tests.")
if(ELSA_COVERAGE) if(ELSA_COVERAGE)
message(STATUS "elsa test coverage is enabled") message(STATUS "elsa test coverage is enabled")
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include "IdenticalBlocksDescriptor.h" #include "IdenticalBlocksDescriptor.h"
#include "testHelpers.h" #include "testHelpers.h"
#include <type_traits>
using namespace elsa; using namespace elsa;
using namespace Catch::literals; // to enable 0.0_a approximate floats using namespace Catch::literals; // to enable 0.0_a approximate floats
...@@ -43,6 +45,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataContainers", "", (TestHel ...@@ -43,6 +45,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataContainers", "", (TestHel
{ {
using data_t = typename TestType::data_t; using data_t = typename TestType::data_t;
INFO("Testing type: " << TypeName_v<const data_t>);
GIVEN("a DataDescriptor") GIVEN("a DataDescriptor")
{ {
IndexVector_t numCoeff(3); IndexVector_t numCoeff(3);
...@@ -63,8 +67,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataContainers", "", (TestHel ...@@ -63,8 +67,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataContainers", "", (TestHel
WHEN("constructing an initialized DataContainer") WHEN("constructing an initialized DataContainer")
{ {
Eigen::Matrix<data_t, Eigen::Dynamic, 1> data{desc.getNumberOfCoefficients()}; auto data = generateRandomMatrix<data_t>(desc.getNumberOfCoefficients());
data.setRandom();
DataContainer<data_t> dc(desc, data, TestType::handler_t); DataContainer<data_t> dc(desc, data, TestType::handler_t);
...@@ -87,8 +90,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataContainers", "", (TestHel ...@@ -87,8 +90,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataContainers", "", (TestHel
DataDescriptor desc(numCoeff); DataDescriptor desc(numCoeff);
DataContainer<data_t> otherDc(desc, TestType::handler_t); DataContainer<data_t> otherDc(desc, TestType::handler_t);
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{otherDc.getSize()};
randVec.setRandom(); auto randVec = generateRandomMatrix<data_t>(otherDc.getSize());
for (index_t i = 0; i < otherDc.getSize(); ++i) for (index_t i = 0; i < otherDc.getSize(); ++i)
otherDc[i] = randVec(i); otherDc[i] = randVec(i);
...@@ -165,6 +168,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Element-wise access of DataContainers", "" ...@@ -165,6 +168,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Element-wise access of DataContainers", ""
{ {
using data_t = typename TestType::data_t; using data_t = typename TestType::data_t;
INFO("Testing type: " << TypeName_v<const data_t>);
GIVEN("a DataContainer") GIVEN("a DataContainer")
{ {
IndexVector_t numCoeff(2); IndexVector_t numCoeff(2);
...@@ -206,19 +211,17 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the reduction operations of DataCo ...@@ -206,19 +211,17 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the reduction operations of DataCo
{ {
using data_t = typename TestType::data_t; using data_t = typename TestType::data_t;
INFO("Testing type: " << TypeName_v<const data_t>);
GIVEN("a DataContainer") GIVEN("a DataContainer")
{ {
IndexVector_t numCoeff(3); IndexVector_t numCoeff(3);
numCoeff << 11, 73, 45; numCoeff << 11, 73, 45;
DataDescriptor desc(numCoeff); DataDescriptor desc(numCoeff);
DataContainer<data_t> dc(desc, TestType::handler_t);
WHEN("putting in some random data") WHEN("putting in some random data")
{ {
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{dc.getSize()}; auto [dc, randVec] = generateRandomContainer<data_t>(desc, TestType::handler_t);
randVec.setRandom();
for (index_t i = 0; i < dc.getSize(); ++i)
dc[i] = randVec(i);
THEN("the reductions work as expected") THEN("the reductions work as expected")
{ {
...@@ -227,13 +230,9 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the reduction operations of DataCo ...@@ -227,13 +230,9 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the reduction operations of DataCo
REQUIRE(checkSameNumbers(dc.lInfNorm(), randVec.array().abs().maxCoeff())); REQUIRE(checkSameNumbers(dc.lInfNorm(), randVec.array().abs().maxCoeff()));
REQUIRE(checkSameNumbers(dc.squaredL2Norm(), randVec.squaredNorm())); REQUIRE(checkSameNumbers(dc.squaredL2Norm(), randVec.squaredNorm()));
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec2{dc.getSize()}; auto [dc2, randVec2] = generateRandomContainer<data_t>(desc, TestType::handler_t);
randVec2.setRandom();
DataContainer<data_t> dc2(desc, TestType::handler_t);
for (index_t i = 0; i < dc2.getSize(); ++i)
dc2[i] = randVec2(i);
REQUIRE(checkSameNumbers(dc.dot(dc2), randVec.dot(randVec2), 10)); REQUIRE(checkSameNumbers(dc.dot(dc2), randVec.dot(randVec2)));
} }
} }
} }
...@@ -251,25 +250,23 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat ...@@ -251,25 +250,23 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat
{ {
using data_t = typename TestType::data_t; using data_t = typename TestType::data_t;
INFO("Testing type: " << TypeName_v<const data_t>);
GIVEN("a DataContainer") GIVEN("a DataContainer")
{ {
IndexVector_t numCoeff(2); IndexVector_t numCoeff(2);
numCoeff << 47, 11; numCoeff << 47, 11;
DataDescriptor desc(numCoeff); DataDescriptor desc(numCoeff);
DataContainer<data_t> dc(desc, TestType::handler_t);
WHEN("putting in some random data") WHEN("putting in some random data")
{ {
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{dc.getSize()}; auto [dc, randVec] = generateRandomContainer<data_t>(desc, TestType::handler_t);
randVec.setRandom();
for (index_t i = 0; i < dc.getSize(); ++i)
dc[i] = randVec(i);
THEN("the element-wise unary operations work as expected") THEN("the element-wise unary operations work as expected")
{ {
DataContainer dcSquare = square(dc); DataContainer dcSquare = square(dc);
for (index_t i = 0; i < dc.getSize(); ++i) for (index_t i = 0; i < dc.getSize(); ++i)
REQUIRE(checkSameNumbers(dcSquare[i], randVec.array().square()[i], 10)); REQUIRE(checkSameNumbers(dcSquare[i], randVec.array().square()[i]));
DataContainer dcSqrt = sqrt(dcSquare); DataContainer dcSqrt = sqrt(dcSquare);
for (index_t i = 0; i < dc.getSize(); ++i) for (index_t i = 0; i < dc.getSize(); ++i)
REQUIRE(checkSameNumbers(dcSqrt[i], randVec.array().square().sqrt()[i])); REQUIRE(checkSameNumbers(dcSqrt[i], randVec.array().square().sqrt()[i]));
...@@ -284,7 +281,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat ...@@ -284,7 +281,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat
DataContainer dcLog = log(dcSquare); DataContainer dcLog = log(dcSquare);
for (index_t i = 0; i < dc.getSize(); ++i) for (index_t i = 0; i < dc.getSize(); ++i)
REQUIRE(checkSameNumbers(dcLog[i], randVec.array().square().log()[i], 100)); REQUIRE(checkSameNumbers(dcLog[i], randVec.array().square().log()[i]));
} }
auto scalar = static_cast<data_t>(923.41f); auto scalar = static_cast<data_t>(923.41f);
...@@ -327,16 +324,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat ...@@ -327,16 +324,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat
WHEN("having two containers with random data") WHEN("having two containers with random data")
{ {
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{dc.getSize()}; auto [dc, randVec] = generateRandomContainer<data_t>(desc, TestType::handler_t);
randVec.setRandom(); auto [dc2, randVec2] = generateRandomContainer<data_t>(desc, TestType::handler_t);
for (index_t i = 0; i < dc.getSize(); ++i)
dc[i] = randVec(i);
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec2{dc.getSize()};
randVec2.setRandom();
DataContainer<data_t> dc2(desc, TestType::handler_t);
for (index_t i = 0; i < dc2.getSize(); ++i)
dc2[i] = randVec2[i];
THEN("the element-wise in-place addition works as expected") THEN("the element-wise in-place addition works as expected")
{ {
...@@ -356,7 +345,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat ...@@ -356,7 +345,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat
{ {
dc *= dc2; dc *= dc2;
for (index_t i = 0; i < dc.getSize(); ++i) for (index_t i = 0; i < dc.getSize(); ++i)
REQUIRE(checkSameNumbers(dc[i], randVec(i) * randVec2(i), 100)); REQUIRE(checkSameNumbers(dc[i], randVec(i) * randVec2(i)));
} }
THEN("the element-wise in-place division works as expected") THEN("the element-wise in-place division works as expected")
...@@ -364,7 +353,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat ...@@ -364,7 +353,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat
dc /= dc2; dc /= dc2;
for (index_t i = 0; i < dc.getSize(); ++i) for (index_t i = 0; i < dc.getSize(); ++i)
if (dc2[i] != data_t(0)) if (dc2[i] != data_t(0))
REQUIRE(checkSameNumbers(dc[i], randVec(i) / randVec2(i), 10)); REQUIRE(checkSameNumbers(dc[i], randVec(i) / randVec2(i)));
} }
} }
} }
...@@ -383,24 +372,16 @@ TEMPLATE_PRODUCT_TEST_CASE( ...@@ -383,24 +372,16 @@ TEMPLATE_PRODUCT_TEST_CASE(
{ {
using data_t = typename TestType::data_t; using data_t = typename TestType::data_t;
INFO("Testing type: " << TypeName_v<const data_t>);
GIVEN("some DataContainers") GIVEN("some DataContainers")
{ {
IndexVector_t numCoeff(3); IndexVector_t numCoeff(3);
numCoeff << 52, 7, 29; numCoeff << 52, 7, 29;
DataDescriptor desc(numCoeff); DataDescriptor desc(numCoeff);
DataContainer<data_t> dc(desc, TestType::handler_t); auto [dc, randVec] = generateRandomContainer<data_t>(desc, TestType::handler_t);
DataContainer<data_t> dc2(desc, TestType::handler_t); auto [dc2, randVec2] = generateRandomContainer<data_t>(desc, TestType::handler_t);
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{dc.getSize()};
randVec.setRandom();
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec2{dc.getSize()};
randVec2.setRandom();
for (index_t i = 0; i < dc.getSize(); ++i) {
dc[i] = randVec(i);
dc2[i] = randVec2(i);
}
THEN("the binary element-wise operations work as expected") THEN("the binary element-wise operations work as expected")
{ {
...@@ -414,12 +395,12 @@ TEMPLATE_PRODUCT_TEST_CASE( ...@@ -414,12 +395,12 @@ TEMPLATE_PRODUCT_TEST_CASE(
DataContainer resultMult = dc * dc2; DataContainer resultMult = dc * dc2;
for (index_t i = 0; i < dc.getSize(); ++i) for (index_t i = 0; i < dc.getSize(); ++i)
REQUIRE(checkSameNumbers(resultMult[i], dc[i] * dc2[i], 100)); REQUIRE(checkSameNumbers(resultMult[i], dc[i] * dc2[i]));
DataContainer resultDiv = dc / dc2; DataContainer resultDiv = dc / dc2;
for (index_t i = 0; i < dc.getSize(); ++i) for (index_t i = 0; i < dc.getSize(); ++i)
if (dc2[i] != data_t(0)) if (dc2[i] != data_t(0))
REQUIRE(checkSameNumbers(resultDiv[i], dc[i] / dc2[i], 1000)); REQUIRE(checkSameNumbers(resultDiv[i], dc[i] / dc2[i]));
} }
THEN("the operations with a scalar work as expected") THEN("the operations with a scalar work as expected")
...@@ -474,6 +455,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing creation of Maps through DataConta ...@@ -474,6 +455,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing creation of Maps through DataConta
{ {
using data_t = typename TestType::data_t; using data_t = typename TestType::data_t;
INFO("Testing type: " << TypeName_v<const data_t>);
GIVEN("a non-blocked container") GIVEN("a non-blocked container")
{ {
IndexVector_t numCoeff(3); IndexVector_t numCoeff(3);
...@@ -600,8 +583,7 @@ TEMPLATE_TEST_CASE("Scenario: Testing loading data to GPU and vice versa.", "", ...@@ -600,8 +583,7 @@ TEMPLATE_TEST_CASE("Scenario: Testing loading data to GPU and vice versa.", "",
DataContainer<TestType> dcCPU(desc, DataHandlerType::CPU); DataContainer<TestType> dcCPU(desc, DataHandlerType::CPU);
DataContainer<TestType> dcGPU(desc, DataHandlerType::GPU); DataContainer<TestType> dcGPU(desc, DataHandlerType::GPU);
Eigen::Matrix<TestType, Eigen::Dynamic, 1> randVec{dcCPU.getSize()}; auto randVec = generateRandomMatrix<TestType>(dcCPU.getSize());
randVec.setRandom();
for (index_t i = 0; i < dcCPU.getSize(); ++i) { for (index_t i = 0; i < dcCPU.getSize(); ++i) {
dcCPU[i] = randVec(i); dcCPU[i] = randVec(i);
......
...@@ -786,14 +786,14 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat ...@@ -786,14 +786,14 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing the element-wise operations of Dat
for (index_t i = 0; i < size; ++i) for (index_t i = 0; i < size; ++i)
if (dh2[i] != data_t(0)) if (dh2[i] != data_t(0))
// due to floating point arithmetic less precision // due to floating point arithmetic less precision
REQUIRE(checkSameNumbers(dh[i], oldDh[i] / dh2[i], 100)); REQUIRE(checkSameNumbers(dh[i], oldDh[i] / dh2[i]));
dh = oldDh; dh = oldDh;
dh /= dhCPU; dh /= dhCPU;
for (index_t i = 0; i < size; ++i) for (index_t i = 0; i < size; ++i)
if (dhCPU[i] != data_t(0)) if (dhCPU[i] != data_t(0))
// due to floating point arithmetic less precision // due to floating point arithmetic less precision
REQUIRE(checkSameNumbers(dh[i], oldDh[i] / dhCPU[i], 100)); REQUIRE(checkSameNumbers(dh[i], oldDh[i] / dhCPU[i]));
} }
THEN("the element-wise binary scalar operations work as expected") THEN("the element-wise binary scalar operations work as expected")
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include "DataHandlerMapCPU.h" #include "DataHandlerMapCPU.h"
#include "testHelpers.h" #include "testHelpers.h"
#include <iostream>
#ifdef ELSA_CUDA_VECTOR #ifdef ELSA_CUDA_VECTOR
#include "DataHandlerGPU.h" #include "DataHandlerGPU.h"
#include "DataHandlerMapGPU.h" #include "DataHandlerMapGPU.h"
...@@ -58,8 +60,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataHandler", "", (DataHandle ...@@ -58,8 +60,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataHandler", "", (DataHandle
WHEN("constructing with a given vector") WHEN("constructing with a given vector")
{ {
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{size}; auto randVec = generateRandomMatrix<data_t>(size);
randVec.setRandom();
const TestType dh{randVec}; const TestType dh{randVec};
for (index_t i = 0; i < size; ++i) for (index_t i = 0; i < size; ++i)
...@@ -68,8 +69,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataHandler", "", (DataHandle ...@@ -68,8 +69,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataHandler", "", (DataHandle
WHEN("copy constructing") WHEN("copy constructing")
{ {
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{size}; auto randVec = generateRandomMatrix<data_t>(size);
randVec.setRandom();
const TestType dh{randVec}; const TestType dh{randVec};
const auto dhView = dh.getBlock(0, size); const auto dhView = dh.getBlock(0, size);
...@@ -93,8 +93,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataHandler", "", (DataHandle ...@@ -93,8 +93,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Constructing DataHandler", "", (DataHandle
WHEN("move constructing") WHEN("move constructing")
{ {
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{size}; auto randVec = generateRandomMatrix<data_t>(size);
randVec.setRandom();
TestType dh{randVec}; TestType dh{randVec};
const auto dhView = dh.getBlock(0, size); const auto dhView = dh.getBlock(0, size);
TestType testDh{randVec}; TestType testDh{randVec};
...@@ -125,9 +124,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing equality operator on DataHandler", ...@@ -125,9 +124,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Testing equality operator on DataHandler",
GIVEN("some DataHandler") GIVEN("some DataHandler")
{ {
index_t size = 314; const index_t size = 314;
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{size}; auto randVec = generateRandomMatrix<data_t>(size);
randVec.setRandom();
const TestType dh{randVec}; const TestType dh{randVec};
WHEN("comparing to a handler with a different size") WHEN("comparing to a handler with a different size")
...@@ -186,14 +184,14 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Assigning to DataHandlerCPU", "", (DataHan ...@@ -186,14 +184,14 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Assigning to DataHandlerCPU", "", (DataHan
GIVEN("a DataHandlerCPU with an associated map") GIVEN("a DataHandlerCPU with an associated map")
{ {
index_t size = 314; const index_t size = 314;
DataHandlerCPU<data_t> dh{size}; DataHandlerCPU<data_t> dh{size};
auto dhMap = dh.getBlock(size / 2, size / 3); auto dhMap = dh.getBlock(size / 2, size / 3);
WHEN("copy assigning") WHEN("copy assigning")
{ {
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{size};
randVec.setRandom(); auto randVec = generateRandomMatrix<data_t>(size);
const DataHandlerCPU dh2{randVec}; const DataHandlerCPU dh2{randVec};
const auto dh2Map = dh2.getBlock(size / 2, size / 3); const auto dh2Map = dh2.getBlock(size / 2, size / 3);
...@@ -214,8 +212,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Assigning to DataHandlerCPU", "", (DataHan ...@@ -214,8 +212,7 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Assigning to DataHandlerCPU", "", (DataHan
WHEN("move assigning") WHEN("move assigning")
{ {
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{size}; auto randVec = generateRandomMatrix<data_t>(size);
randVec.setRandom();
DataHandlerCPU dh2{randVec}; DataHandlerCPU dh2{randVec};
const auto dh2View = dh2.getBlock(0, size); const auto dh2View = dh2.getBlock(0, size);
DataHandlerCPU testDh{randVec}; DataHandlerCPU testDh{randVec};
...@@ -241,8 +238,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Assigning to DataHandlerCPU", "", (DataHan ...@@ -241,8 +238,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Assigning to DataHandlerCPU", "", (DataHan
WHEN("copy assigning a DataHandlerCPU through base pointers") WHEN("copy assigning a DataHandlerCPU through base pointers")
{ {
DataHandler<data_t>* dhPtr = &dh; DataHandler<data_t>* dhPtr = &dh;
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{size};
randVec.setRandom(); auto randVec = generateRandomMatrix<data_t>(size);
const auto dh2Ptr = std::make_unique<const DataHandlerCPU<data_t>>(randVec); const auto dh2Ptr = std::make_unique<const DataHandlerCPU<data_t>>(randVec);
const auto dh2Map = dh2Ptr->getBlock(size / 2, size / 3); const auto dh2Map = dh2Ptr->getBlock(size / 2, size / 3);
...@@ -270,8 +267,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Assigning to DataHandlerCPU", "", (DataHan ...@@ -270,8 +267,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Assigning to DataHandlerCPU", "", (DataHan
{ {
DataHandler<data_t>* dhPtr = &dh; DataHandler<data_t>* dhPtr = &dh;
const auto dhCopy = dh; const auto dhCopy = dh;
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{2 * size};
randVec.setRandom(); auto randVec = generateRandomMatrix<data_t>(2 * size);
const DataHandlerCPU<data_t> dh2{randVec}; const DataHandlerCPU<data_t> dh2{randVec};
const auto dh2Map = dh2.getBlock(0, size); const auto dh2Map = dh2.getBlock(0, size);
...@@ -295,8 +292,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Assigning to DataHandlerCPU", "", (DataHan ...@@ -295,8 +292,8 @@ TEMPLATE_PRODUCT_TEST_CASE("Scenario: Assigning to DataHandlerCPU", "", (DataHan
WHEN("copy assigning a full DataHandlerMapCPU (aka a view) through base pointers") WHEN("copy assigning a full DataHandlerMapCPU (aka a view) through base pointers")
{ {
DataHandler<data_t>* dhPtr = &dh; DataHandler<data_t>* dhPtr = &dh;
Eigen::Matrix<data_t, Eigen::Dynamic, 1> randVec{size};
randVec.setRandom(); auto randVec = generateRandomMatrix<data_t>(size);