GCC Code Coverage Report


Directory: ./
File: python/ndcurves/namespace.cpp
Date: 2025-03-05 17:18:30
Exec Total Coverage
Lines: 8 8 100.0%
Branches: 12 24 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2019 INRIA
3 //
4
5 #include "namespace.h"
6
7 namespace ndcurves {
8 namespace python {
9
10 8 bp::object getOrCreatePythonNamespace(const std::string& submodule_name) {
11
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 bp::scope current_scope;
12 std::string current_scope_name(
13
5/10
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 8 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 8 times.
✗ Branch 15 not taken.
8 bp::extract<const char*>(current_scope.attr("__name__")));
14 std::string complete_submodule_name =
15
2/4
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
8 current_scope_name + "." + submodule_name;
16
17 bp::object submodule(
18
2/4
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 8 times.
✗ Branch 7 not taken.
8 bp::borrowed(PyImport_AddModule(complete_submodule_name.c_str())));
19
2/4
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
8 current_scope.attr(submodule_name.c_str()) = submodule;
20
21 16 return submodule;
22 8 }
23 } // namespace python
24 } // namespace ndcurves
25