diff --git a/cardmech/test/CMakeLists.txt b/cardmech/test/CMakeLists.txt index 8829a17bcee28f4859a8c8a66541f962a20c180a..2db9d729ebd9151b8e5a9a9703de15a661cde330 100644 --- a/cardmech/test/CMakeLists.txt +++ b/cardmech/test/CMakeLists.txt @@ -1,3 +1,5 @@ +add_mpp_test(TestVolumeCalculation CARDMECH_LIBRARIES) + include_directories(cellmodels) add_subdirectory(cellmodels) diff --git a/cardmech/test/TestVolumeCalculation.cpp b/cardmech/test/TestVolumeCalculation.cpp new file mode 100644 index 0000000000000000000000000000000000000000..68ea2fbe23455ce8d85029e9578a181a8dcb915a --- /dev/null +++ b/cardmech/test/TestVolumeCalculation.cpp @@ -0,0 +1,45 @@ +#include "TestEnvironment.hpp" +#include "Celltype.hpp" +#include "CardiacData.hpp" + +struct CellParam { + CELLTYPE type; + std::vector<Point> corners; + double volume; +}; + + +class CellVolumeTest : public TestWithParam<CellParam> { +protected: + double volume; +public: + CellVolumeTest() = default; +}; + + +TEST_P(CellVolumeTest, Volumes) { + ASSERT_DOUBLE_EQ(Volume(GetParam().type, GetParam().corners), GetParam().volume); +} + +INSTANTIATE_TEST_SUITE_P(TestVolumeFunctions, CellVolumeTest, Values( + CellParam{TRIANGLE, {Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(0.0, 1.0, 0.0)}, 0.5}, + CellParam{TRIANGLE, {Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(0.5, 1.0, 0.0)}, 0.5}, + CellParam{TRIANGLE, {Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(0.0, 2.0, 0.0)}, 1.0}, + CellParam{TRIANGLE, {Point(0.0, 0.0, 0.0), Point(2.0, 0.0, 0.0), Point(1.0, 1.0, 0.0)}, 1.0}, + CellParam{QUADRILATERAL, {Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0), + Point(0.0, 1.0, 0.0)}, 1.0}, + CellParam{QUADRILATERAL, {Point(0.0, 0.0, 0.0), Point(4.0, 0.0, 0.0), Point(3.0, 1.0, 0.0), + Point(1.0, 1.0, 0.0)}, 3.0}, + CellParam{TETRAHEDRON, {Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(0.0, 1.0, 0.0), + Point(0.0, 0.0, 1.0)}, 1.0 / 6.0}, + CellParam{TETRAHEDRON, {Point(0.0, 0.0, 0.0), Point(2.0, 0.0, 0.0), Point(1.0, 1.0, 0.0), + Point(0.0, 1.0, 3.0)}, 1.0}, + CellParam{HEXAHEDRON, {Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0), + Point(0.0, 1.0, 0.0), Point(0.0, 0.0, 1.0), Point(1.0, 0.0, 1.0), + Point(1.0, 1.0, 1.0), Point(0.0, 1.0, 1.0)}, 1.0} +)); + +int main(int argc, char **argv) { + MppTest mppTest = MppTestBuilder(argc, argv).WithScreenLogging(); + return mppTest.RUN_ALL_MPP_TESTS(); +} \ No newline at end of file diff --git a/cardmech/test/elasticity/TestVolumePenalty.cpp b/cardmech/test/elasticity/TestVolumePenalty.cpp index a9280a597cba7f1af4c0a3769c38337e84ade140..b474b38bb3bcf4ac154b674c82675ccf06894929 100644 --- a/cardmech/test/elasticity/TestVolumePenalty.cpp +++ b/cardmech/test/elasticity/TestVolumePenalty.cpp @@ -68,6 +68,11 @@ TEST_P(VolumePenaltyTest, Consistency) { } + +TEST_P(VolumePenaltyTest, Compressibility) { + mout << "Can't do multiple runs with different volume penalties." << endl; +} + INSTANTIATE_TEST_SUITE_P(TestVolumeFunctions, VolumePenaltyTest, Values( "None", "Ciarlet", "Logarithmic" ));