Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 8598cba1 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1246 Test about Pk2 operator: introduce fixtures... just to separate clearly...

#1246 Test about Pk2 operator: introduce fixtures... just to separate clearly the tests, with printing on screen that explain what is tested.
parent 5990580f
No related branches found
No related tags found
1 merge request!12Tag v18.12
...@@ -20,7 +20,7 @@ namespace MoReFEM ...@@ -20,7 +20,7 @@ namespace MoReFEM
Model::Model(const morefem_data_type& morefem_data) Model::Model(const morefem_data_type& morefem_data)
: parent(morefem_data, create_domain_list_for_coords::yes) : parent(morefem_data, create_domain_list_for_coords::yes, print_banner::no)
{ {
decltype(auto) mpi = parent::GetMpi(); decltype(auto) mpi = parent::GetMpi();
...@@ -31,7 +31,6 @@ namespace MoReFEM ...@@ -31,7 +31,6 @@ namespace MoReFEM
"run it sequentially.", "run it sequentially.",
__FILE__, __LINE__); __FILE__, __LINE__);
} }
} }
...@@ -71,8 +70,6 @@ namespace MoReFEM ...@@ -71,8 +70,6 @@ namespace MoReFEM
// Required to enable construction of an operator after initialization step. // Required to enable construction of an operator after initialization step.
parent::SetClearGodOfDofTemporaryDataToFalse(); parent::SetClearGodOfDofTemporaryDataToFalse();
std::cout << "SUPPL INITIALIZE DONE" << std::endl;
} }
......
...@@ -33,9 +33,8 @@ namespace // anonymous ...@@ -33,9 +33,8 @@ namespace // anonymous
static const type& StaticInitMoReFEMData(); static const type& StaticInitMoReFEMData();
const TestNS::Pk2::Model& GetModel() const noexcept; static const TestNS::Pk2::Model& GetModel();
std::unique_ptr<TestNS::Pk2::Model> model_ = nullptr;
}; };
...@@ -45,25 +44,19 @@ namespace // anonymous ...@@ -45,25 +44,19 @@ namespace // anonymous
TEST_CASE_METHOD(Fixture, "Unknown and test function unknown are identical") TEST_CASE_METHOD(Fixture, "Unknown and test function unknown are identical")
{ {
std::cout << "BEGIN SAME Unknown" << std::endl;
GetModel().SameUnknown(); GetModel().SameUnknown();
std::cout << "END SAME Unknown" << std::endl;
} }
TEST_CASE_METHOD(Fixture, "Unknown and test function unknown are different but share the same P1 shape function label") TEST_CASE_METHOD(Fixture, "Unknown and test function unknown are different but share the same P1 shape function label")
{ {
std::cout << "BEGIN DIFF Unknown" << std::endl;
GetModel().UnknownP1TestP1(); GetModel().UnknownP1TestP1();
std::cout << "END DIFF Unknown" << std::endl;
} }
TEST_CASE_METHOD(Fixture, "Unknown and test function unknown are different; unknown is P2 and test function P1") TEST_CASE_METHOD(Fixture, "Unknown and test function unknown are different; unknown is P2 and test function P1")
{ {
std::cout << "BEGIN DIFF 2 Unknown" << std::endl;
GetModel().UnknownP2TestP1(); GetModel().UnknownP2TestP1();
std::cout << "END DIFF 2 Unknown" << std::endl;
} }
...@@ -82,34 +75,30 @@ namespace // anonymous ...@@ -82,34 +75,30 @@ namespace // anonymous
} }
Fixture::Fixture() const TestNS::Pk2::Model& Fixture::GetModel()
{ {
std::cout << "FIXTURE CONSTRUCTOR" << std::endl; static bool first_call = true;
static auto ptr = std::make_unique<TestNS::Pk2::Model>(StaticInitMoReFEMData().GetMoReFEMData());
decltype(auto) morefem_data = StaticInitMoReFEMData().GetMoReFEMData(); if (first_call)
const auto& mpi = morefem_data.GetMpi(); {
ptr->Run(StaticInitMoReFEMData().GetMoReFEMData());
first_call = false;
}
model_ = std::make_unique<TestNS::Pk2::Model>(morefem_data); return *ptr;
assert(!(!model_));
model_->Run(morefem_data);
std::cout << "FIXTURE CONSTRUCTOR DONE" << std::endl;
} }
Fixture::~Fixture() Fixture::Fixture()
{ {
model_ = nullptr;
Internal::MeshNS::GeometricMeshRegionManager::GetInstance(__FILE__, __LINE__).Destroy();
} }
Fixture::~Fixture()
const TestNS::Pk2::Model& Fixture::GetModel() const noexcept
{ {
assert(!(!model_));
return *model_;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment