Skip to content
Snippets Groups Projects
Commit 5ffe154d authored by jonathan.froehlich's avatar jonathan.froehlich
Browse files

Added volume tests

parent 1c7bea04
No related branches found
No related tags found
3 merge requests!153Local add output info,!144Debug cardmech,!120Resolve "Calculate material volume"
Pipeline #123702 passed
add_mpp_test(TestVolumeCalculation CARDMECH_LIBRARIES)
include_directories(cellmodels)
add_subdirectory(cellmodels)
......
#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
......@@ -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"
));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment