Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
0b05b6f6
Unverified
Commit
0b05b6f6
authored
Sep 28, 2021
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
run tests in build dir
parent
63821701
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
13 deletions
+32
-13
CMakeLists.txt
+2
-4
src/Compound.cpp
+5
-1
test/rename-compound-test.cpp
+9
-4
test/unit-test.cpp
+16
-4
No files found.
CMakeLists.txt
View file @
0b05b6f6
...
...
@@ -457,12 +457,10 @@ if(CIFPP_BUILD_TESTS)
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_BINARY_DIR
}
/Run
${
CIFPP_TEST
}
.touch
COMMAND $<TARGET_FILE:
${
CIFPP_TEST
}
>
WORKING_DIRECTORY
${
PROJECT_SOURCE_DIR
}
/test
)
COMMAND $<TARGET_FILE:
${
CIFPP_TEST
}
> --
${
PROJECT_SOURCE_DIR
}
/test
)
add_test
(
NAME
${
CIFPP_TEST
}
COMMAND $<TARGET_FILE:
${
CIFPP_TEST
}
>
WORKING_DIRECTORY
${
PROJECT_SOURCE_DIR
}
/test
)
COMMAND $<TARGET_FILE:
${
CIFPP_TEST
}
> --
${
PROJECT_SOURCE_DIR
}
/test
)
endforeach
()
endif
()
...
...
src/Compound.cpp
View file @
0b05b6f6
...
...
@@ -270,7 +270,11 @@ class CompoundFactoryImpl : public std::enable_shared_from_this<CompoundFactoryI
CompoundFactoryImpl
(
const
std
::
string
&
file
,
std
::
shared_ptr
<
CompoundFactoryImpl
>
next
);
virtual
~
CompoundFactoryImpl
()
=
default
;
virtual
~
CompoundFactoryImpl
()
{
for
(
auto
c
:
mCompounds
)
delete
c
;
}
Compound
*
get
(
std
::
string
id
)
{
...
...
test/rename-compound-test.cpp
View file @
0b05b6f6
...
...
@@ -15,12 +15,17 @@ int main(int argc, char* argv[])
try
{
if
(
std
::
filesystem
::
exists
(
"../data/components.cif"
))
cif
::
addFileResource
(
"components.cif"
,
"../data/components.cif"
);
std
::
filesystem
::
path
testdir
=
std
::
filesystem
::
current_path
();
mmcif
::
CompoundFactory
::
instance
().
pushDictionary
(
"RXA.cif"
);
if
(
argc
==
3
)
testdir
=
argv
[
2
];
mmcif
::
File
f
(
"../examples/1cbs.cif.gz"
);
if
(
std
::
filesystem
::
exists
(
testdir
/
".."
/
"data"
/
"components.cif"
))
cif
::
addFileResource
(
"components.cif"
,
testdir
/
".."
/
"data"
/
"components.cif"
);
mmcif
::
CompoundFactory
::
instance
().
pushDictionary
(
testdir
/
"RXA.cif"
);
mmcif
::
File
f
(
testdir
/
".."
/
"examples"
/
"1cbs.cif.gz"
);
mmcif
::
Structure
structure
(
f
);
auto
&
res
=
structure
.
getResidue
(
"B"
,
"REA"
);
...
...
test/unit-test.cpp
View file @
0b05b6f6
...
...
@@ -33,6 +33,8 @@
#include "cif++/Cif++.hpp"
#include "cif++/BondMap.hpp"
std
::
filesystem
::
path
gTestDir
=
std
::
filesystem
::
current_path
();
// filled in first test
// --------------------------------------------------------------------
cif
::
File
operator
""
_cf
(
const
char
*
text
,
size_t
length
)
...
...
@@ -51,12 +53,22 @@ cif::File operator""_cf(const char* text, size_t length)
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE
(
init
)
{
// 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
];
}
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE
(
ut1
)
{
cif
::
VERBOSE
=
1
;
// do this now, avoids the need for installing
cif
::
addFileResource
(
"mmcif_pdbx_v50.dic"
,
"../rsrc/
mmcif_pdbx_v50.dic"
);
cif
::
addFileResource
(
"mmcif_pdbx_v50.dic"
,
gTestDir
/
".."
/
"rsrc"
/
"
mmcif_pdbx_v50.dic"
);
// using namespace mmcif;
...
...
@@ -1515,7 +1527,7 @@ BOOST_AUTO_TEST_CASE(bondmap_1)
{
cif
::
VERBOSE
=
2
;
cif
::
addFileResource
(
"components.cif"
,
"../data/
components.cif"
);
cif
::
addFileResource
(
"components.cif"
,
gTestDir
/
".."
/
"data"
/
"
components.cif"
);
// sections taken from CCD compounds.cif
auto
components
=
R"(
...
...
@@ -1604,7 +1616,7 @@ PRO CD HD3 SING N N 16
PRO OXT HXT SING N N 17
)"
_cf
;
const
std
::
filesystem
::
path
example
(
"../examples/
1cbs.cif.gz"
);
const
std
::
filesystem
::
path
example
(
gTestDir
/
".."
/
"examples"
/
"
1cbs.cif.gz"
);
mmcif
::
File
file
(
example
.
string
());
mmcif
::
Structure
structure
(
file
);
...
...
@@ -1661,7 +1673,7 @@ BOOST_AUTO_TEST_CASE(bondmap_2)
{
BOOST_CHECK_THROW
(
mmcif
::
BondMap
::
atomIDsForCompound
(
"UN_"
),
mmcif
::
BondMapException
);
mmcif
::
CompoundFactory
::
instance
().
pushDictionary
(
"./
UN_.cif"
);
mmcif
::
CompoundFactory
::
instance
().
pushDictionary
(
gTestDir
/
"
UN_.cif"
);
BOOST_CHECK
(
mmcif
::
BondMap
::
atomIDsForCompound
(
"UN_"
).
empty
()
==
false
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment