//This file is part of Bertini 2. // //pool_test.cpp is free software: you can redistribute it and/or modify //it under the terms of the GNU General Public License as published by //the Free Software Foundation, either version 3 of the License, or //(at your option) any later version. // //pool_test.cpp is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU General Public License for more details. // //You should have received a copy of the GNU General Public License //along with pool_test.cpp. If not, see . // // Copyright(C) 2015 - 2021 by Bertini2 Development Team // // See for a copy of the license, // as well as COPYING. Bertini2 is provided with permitted // additional terms in the b2/licenses/ directory. // individual authors of this file include: // silviana amethyst, university of wisconsin eau claire //pool_test.cpp // #define BOOST_TEST_DYN_LINK 1 //this #define MUST appear before #include #define BOOST_TEST_MODULE "Bertini 2 Object Pool Testing" #include #define BERTINI_TEST_MODULE "pools" #include "bertini2/pool/system.hpp" #include "test/utility/enable_logging.hpp" using Variable = bertini::node::Variable; BOOST_AUTO_TEST_SUITE(system_pool) using namespace bertini; BOOST_AUTO_TEST_CASE(make_system_pool) { SystemPool sp; } BOOST_AUTO_TEST_CASE(make_nonpointer_system_and_add_to_pool) { SystemPool sp; System sys; auto x = Variable::Make("x"); auto y = Variable::Make("y"); auto z = Variable::Make("z"); sys.AddVariableGroup(VariableGroup({x,y,z})); sys.AddFunction(x); sys.AddFunction(y); sys.AddFunction(z); auto result = sp.NonPtrAdd(sys); BOOST_CHECK(result.get() != &sys); } BOOST_AUTO_TEST_CASE(make_new_sys_from_pool) { SystemPool sp; std::shared_ptr sys = sp.Make(); auto x = Variable::Make("x"); auto y = Variable::Make("y"); auto z = Variable::Make("z"); sys->AddVariableGroup(VariableGroup({x,y,z})); sys->AddFunction(x); sys->AddFunction(y); sys->AddFunction(z); } BOOST_AUTO_TEST_CASE(add_ptr_sys_to_pool) { SystemPool sp; std::shared_ptr sys = std::make_shared(); auto x = Variable::Make("x"); auto y = Variable::Make("y"); auto z = Variable::Make("z"); sys->AddVariableGroup(VariableGroup({x,y,z})); sys->AddFunction(x); sys->AddFunction(y); sys->AddFunction(z); auto result = sp.PtrAdd(sys); BOOST_CHECK(result.get() == sys.get()); } BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(double_point_pool) using namespace bertini; BOOST_AUTO_TEST_CASE(make_double_point_point) { PointPool pool; } BOOST_AUTO_TEST_SUITE_END()