GCC Code Coverage Report


Directory: ./
File: python/version.cc
Date: 2025-04-01 09:23:31
Exec Total Coverage
Lines: 14 18 77.8%
Branches: 21 62 33.9%

Line Branch Exec Source
1 //
2 // Copyright (c) 2019-2023 CNRS INRIA
3 //
4
5 #include "coal/config.hh"
6 #include "coal.hh"
7 #include <boost/preprocessor/stringize.hpp>
8
9 namespace bp = boost::python;
10
11 inline bool checkVersionAtLeast(int major, int minor, int patch) {
12 return COAL_VERSION_AT_LEAST(major, minor, patch);
13 }
14
15 inline bool checkVersionAtMost(int major, int minor, int patch) {
16 return COAL_VERSION_AT_MOST(major, minor, patch);
17 }
18
19 5 void exposeVersion() {
20 // Define release numbers of the current Coal version.
21
1/2
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
10 bp::scope().attr("__version__") =
22
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 BOOST_PP_STRINGIZE(COAL_MAJOR_VERSION) "." BOOST_PP_STRINGIZE(COAL_MINOR_VERSION) "." BOOST_PP_STRINGIZE(COAL_PATCH_VERSION);
23
2/4
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
5 bp::scope().attr("__raw_version__") = COAL_VERSION;
24
3/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
5 bp::scope().attr("COAL_MAJOR_VERSION") = COAL_MAJOR_VERSION;
25
3/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
5 bp::scope().attr("COAL_MINOR_VERSION") = COAL_MINOR_VERSION;
26
3/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
5 bp::scope().attr("COAL_PATCH_VERSION") = COAL_PATCH_VERSION;
27
28 #if COAL_HAS_QHULL
29 bp::scope().attr("WITH_QHULL") = true;
30 #else
31
3/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
5 bp::scope().attr("WITH_QHULL") = false;
32 #endif
33
34 #if COAL_HAS_OCTOMAP
35
3/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
5 bp::scope().attr("WITH_OCTOMAP") = true;
36 #else
37 bp::scope().attr("WITH_OCTOMAP") = false;
38 #endif
39
40
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 bp::def("checkVersionAtLeast", &checkVersionAtLeast,
41 10 bp::args("major", "minor", "patch"),
42 "Checks if the current version of coal is at least"
43 " the version provided by the input arguments.");
44
45
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 bp::def("checkVersionAtMost", &checkVersionAtMost,
46 10 bp::args("major", "minor", "patch"),
47 "Checks if the current version of coal is at most"
48 " the version provided by the input arguments.");
49 5 }
50