Compare commits

..

4 Commits

Author SHA1 Message Date
Maarten L. Hekkelman
71f7e7c741 Version bump, changelog updated 2021-10-13 11:51:12 +02:00
Maarten L. Hekkelman
cff099596e Fix installation rules for CCD data 2021-10-13 11:32:10 +02:00
Maarten L. Hekkelman
e182604455 Fix all tests to work with embedded data, no CCD, part 4 2021-10-13 11:23:17 +02:00
Maarten L. Hekkelman
45a7defb7e Fix all tests to work with embedded data, no CCD, part 3 2021-10-13 10:55:25 +02:00
5 changed files with 33 additions and 18 deletions

View File

@@ -25,7 +25,7 @@
cmake_minimum_required(VERSION 3.16)
# set the project name
project(cifpp VERSION 2.0.1 LANGUAGES CXX)
project(cifpp VERSION 2.0.2 LANGUAGES CXX)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@@ -364,7 +364,7 @@ install(
install(FILES
${PROJECT_SOURCE_DIR}/rsrc/mmcif_ddl.dic
${PROJECT_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic
${PROJECT_SOURCE_DIR}/data/components.cif
${COMPONENTS_CIF}
DESTINATION ${SHARE_INSTALL_DIR}
)

View File

@@ -1,3 +1,10 @@
Version 2.0.2
- Added configuration flag to disable downloading CCD data during build
Note that there are now two flags for CCD data:
DOWNLOAD_CCD to enable downloading during build
INSTALL_UPDATE_SCRIPT to install an update mechanism for this file
- Updated unit tests to work even if no CCD data is available
Version 2.0.1
- Fixed the generator for the symmetry operator table

View File

@@ -1243,6 +1243,9 @@ void addDataDirectory(std::filesystem::path dataDir)
void addFileResource(const std::string &name, std::filesystem::path dataFile)
{
if (not fs::exists(dataFile))
throw std::runtime_error("Attempt to add a file resource for " + name + " that does not exist: " + dataFile.string());
gLocalResources[name] = dataFile;
}

View File

@@ -24,7 +24,7 @@
* 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 <stdexcept>
@@ -52,18 +52,23 @@ cif::File operator""_cf(const char* text, size_t length)
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)
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
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");
return true;
}
// --------------------------------------------------------------------

View File

@@ -24,7 +24,8 @@
* 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 <stdexcept>
@@ -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
if (boost::unit_test::framework::master_test_suite().argc == 2)
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
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)
{
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;
auto f = R"(data_TEST
@@ -1530,8 +1532,6 @@ BOOST_AUTO_TEST_CASE(bondmap_1)
{
cif::VERBOSE = 2;
cif::addFileResource("components.cif", gTestDir / ".." / "data" / "components.cif");
// sections taken from CCD compounds.cif
auto components = R"(
data_ASN