Line data Source code
1 : /** 2 : * @file test_MHDHandler.cpp 3 : * 4 : * @brief Tests for the MHDHandler class 5 : * 6 : * @author Tobias Lasser - initial code 7 : */ 8 : 9 : #include "doctest/doctest.h" 10 : #include "MHDHandler.h" 11 : #include "VolumeDescriptor.h" 12 : 13 : using namespace elsa; 14 : using namespace doctest; 15 : 16 : TEST_SUITE_BEGIN("io"); 17 : 18 : TEST_CASE("MHDHandler: Reading and writing data") 19 1 : { 20 1 : GIVEN("a DataContainer") 21 1 : { 22 1 : IndexVector_t numCoeff(2); 23 1 : numCoeff << 11, 17; 24 1 : VolumeDescriptor dd(numCoeff); 25 1 : DataContainer dc(dd); 26 1 : dc = 1; 27 : 28 1 : WHEN("writing out and reading in this DataContainer") 29 1 : { 30 1 : std::string filename{"test.mhd"}; 31 1 : std::string rawFile{"test.raw"}; 32 1 : MHD::write(dc, filename, rawFile); 33 1 : auto dcRead = MHD::read(filename); 34 : 35 1 : THEN("the read in DataContainer contains the expected data") 36 1 : { 37 1 : REQUIRE_EQ(dc.getSize(), dcRead.getSize()); 38 1 : REQUIRE_EQ(dc.getDataDescriptor(), dcRead.getDataDescriptor()); 39 : 40 1 : REQUIRE_EQ(dcRead, dc); 41 1 : } 42 1 : } 43 1 : } 44 1 : } 45 : 46 : TEST_SUITE_END();