GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: python/version.cc Lines: 12 16 75.0 %
Date: 2024-02-09 12:57:42 Branches: 15 50 30.0 %

Line Branch Exec Source
1
//
2
// Copyright (c) 2019 CNRS INRIA
3
//
4
5
#include "hpp/fcl/config.hh"
6
#include "fcl.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 HPP_FCL_VERSION_AT_LEAST(major, minor, patch);
13
}
14
15
inline bool checkVersionAtMost(int major, int minor, int patch) {
16
  return HPP_FCL_VERSION_AT_MOST(major, minor, patch);
17
}
18
19
5
void exposeVersion() {
20
  // Define release numbers of the current hpp-fcl version.
21
10
  bp::scope().attr("__version__") =
22
5
      BOOST_PP_STRINGIZE(HPP_FCL_MAJOR_VERSION) "." BOOST_PP_STRINGIZE(HPP_FCL_MINOR_VERSION) "." BOOST_PP_STRINGIZE(HPP_FCL_PATCH_VERSION);
23

5
  bp::scope().attr("__raw_version__") = HPP_FCL_VERSION;
24

5
  bp::scope().attr("HPP_FCL_MAJOR_VERSION") = HPP_FCL_MAJOR_VERSION;
25

5
  bp::scope().attr("HPP_FCL_MINOR_VERSION") = HPP_FCL_MINOR_VERSION;
26

5
  bp::scope().attr("HPP_FCL_PATCH_VERSION") = HPP_FCL_PATCH_VERSION;
27
28
5
  bp::def("checkVersionAtLeast", &checkVersionAtLeast,
29
10
          bp::args("major", "minor", "patch"),
30
          "Checks if the current version of hpp-fcl is at least"
31
          " the version provided by the input arguments.");
32
33
5
  bp::def("checkVersionAtMost", &checkVersionAtMost,
34
10
          bp::args("major", "minor", "patch"),
35
          "Checks if the current version of hpp-fcl is at most"
36
          " the version provided by the input arguments.");
37
5
}