Commit 8598cba1 authored by GILLES Sebastien's avatar GILLES Sebastien

#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
......@@ -20,7 +20,7 @@ namespace MoReFEM
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();
......@@ -31,7 +31,6 @@ namespace MoReFEM
"run it sequentially.",
__FILE__, __LINE__);
}
}
......@@ -71,8 +70,6 @@ namespace MoReFEM
// Required to enable construction of an operator after initialization step.
parent::SetClearGodOfDofTemporaryDataToFalse();
std::cout << "SUPPL INITIALIZE DONE" << std::endl;
}
......
......@@ -33,9 +33,8 @@ namespace // anonymous
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
TEST_CASE_METHOD(Fixture, "Unknown and test function unknown are identical")
{
std::cout << "BEGIN SAME Unknown" << std::endl;
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")
{
std::cout << "BEGIN DIFF Unknown" << std::endl;
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")
{
std::cout << "BEGIN DIFF 2 Unknown" << std::endl;
GetModel().UnknownP2TestP1();
std::cout << "END DIFF 2 Unknown" << std::endl;
}
......@@ -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();
const auto& mpi = morefem_data.GetMpi();
if (first_call)
{
ptr->Run(StaticInitMoReFEMData().GetMoReFEMData());
first_call = false;
}
model_ = std::make_unique<TestNS::Pk2::Model>(morefem_data);
assert(!(!model_));
model_->Run(morefem_data);
std::cout << "FIXTURE CONSTRUCTOR DONE" << std::endl;
return *ptr;
}
Fixture::~Fixture()
Fixture::Fixture()
{
model_ = nullptr;
Internal::MeshNS::GeometricMeshRegionManager::GetInstance(__FILE__, __LINE__).Destroy();
}
const TestNS::Pk2::Model& Fixture::GetModel() const noexcept
Fixture::~Fixture()
{
assert(!(!model_));
return *model_;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment