Commit 45a7defb by Maarten L. Hekkelman

Fix all tests to work with embedded data, no CCD, part 3

parent 906f6ac1
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#define BOOST_TEST_MODULE Structure_Test #define BOOST_TEST_ALTERNATIVE_INIT_API
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <stdexcept> #include <stdexcept>
...@@ -52,18 +52,23 @@ cif::File operator""_cf(const char* text, size_t length) ...@@ -52,18 +52,23 @@ cif::File operator""_cf(const char* text, size_t length)
std::filesystem::path gTestDir = std::filesystem::current_path(); std::filesystem::path gTestDir = std::filesystem::current_path();
BOOST_AUTO_TEST_CASE(init) bool init_unit_test()
{ {
// not a test, just initialize test dir cif::VERBOSE = 1;
// not a test, just initialize test dir
if (boost::unit_test::framework::master_test_suite().argc == 2) if (boost::unit_test::framework::master_test_suite().argc == 2)
gTestDir = boost::unit_test::framework::master_test_suite().argv[1]; gTestDir = boost::unit_test::framework::master_test_suite().argv[1];
// do this now, avoids the need for installing
cif::addFileResource("mmcif_pdbx_v50.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx_v50.dic");
// initialize CCD location // initialize CCD location
if (std::filesystem::exists(gTestDir / ".." / "data" / "ccd-subset.cif")) cif::addFileResource("components.cif", gTestDir / ".." / "data" / "ccd-subset.cif");
cif::addFileResource("components.cif", gTestDir / ".." / "data" / "ccd-subset.cif");
mmcif::CompoundFactory::instance().pushDictionary(gTestDir / "HEM.cif"); mmcif::CompoundFactory::instance().pushDictionary(gTestDir / "HEM.cif");
return true;
} }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#define BOOST_TEST_MODULE LibCifPP_Test #define BOOST_TEST_ALTERNATIVE_INIT_API
// #define BOOST_TEST_MODULE LibCifPP_Test
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <stdexcept> #include <stdexcept>
...@@ -53,26 +54,27 @@ cif::File operator""_cf(const char* text, size_t length) ...@@ -53,26 +54,27 @@ cif::File operator""_cf(const char* text, size_t length)
// -------------------------------------------------------------------- // --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE(init) bool init_unit_test()
{ {
cif::VERBOSE = 1;
// not a test, just initialize test dir // not a test, just initialize test dir
if (boost::unit_test::framework::master_test_suite().argc == 2) if (boost::unit_test::framework::master_test_suite().argc == 2)
gTestDir = boost::unit_test::framework::master_test_suite().argv[1]; gTestDir = boost::unit_test::framework::master_test_suite().argv[1];
// do this now, avoids the need for installing
cif::addFileResource("mmcif_pdbx_v50.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx_v50.dic");
// initialize CCD location // initialize CCD location
if (std::filesystem::exists(gTestDir / ".." / "data" / "ccd-subset.cif")) cif::addFileResource("components.cif", gTestDir / ".." / "data" / "ccd-subset.cif");
cif::addFileResource("components.cif", gTestDir / ".." / "data" / "ccd-subset.cif");
return true;
} }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE(ut1) BOOST_AUTO_TEST_CASE(ut1)
{ {
cif::VERBOSE = 1;
// do this now, avoids the need for installing
cif::addFileResource("mmcif_pdbx_v50.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx_v50.dic");
// using namespace mmcif; // using namespace mmcif;
auto f = R"(data_TEST auto f = R"(data_TEST
......
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