LCOV - code coverage report
Current view: top level - io/tests - test_MHDHandler.cpp (source / functions) Hit Total Coverage
Test: test_coverage.info.cleaned Lines: 17 17 100.0 %
Date: 2022-02-28 03:37:41 Functions: 1 1 100.0 %

          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           1 : TEST_CASE("MHDHandler: Reading and writing data")
      19             : {
      20           2 :     GIVEN("a DataContainer")
      21             :     {
      22           2 :         IndexVector_t numCoeff(2);
      23           1 :         numCoeff << 11, 17;
      24           2 :         VolumeDescriptor dd(numCoeff);
      25           2 :         DataContainer dc(dd);
      26           1 :         dc = 1;
      27             : 
      28           2 :         WHEN("writing out and reading in this DataContainer")
      29             :         {
      30           2 :             std::string filename{"test.mhd"};
      31           2 :             std::string rawFile{"test.raw"};
      32           1 :             MHD::write(dc, filename, rawFile);
      33           2 :             auto dcRead = MHD::read(filename);
      34             : 
      35           2 :             THEN("the read in DataContainer contains the expected data")
      36             :             {
      37           1 :                 REQUIRE_EQ(dc.getSize(), dcRead.getSize());
      38           1 :                 REQUIRE_EQ(dc.getDataDescriptor(), dcRead.getDataDescriptor());
      39             : 
      40           1 :                 REQUIRE_EQ(dcRead, dc);
      41             :             }
      42             :         }
      43             :     }
      44           1 : }
      45             : 
      46             : TEST_SUITE_END();

Generated by: LCOV version 1.15