File: test_python_ptr.cpp

package info (click to toggle)
intrusive-shared-ptr 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 412 kB
  • sloc: cpp: 2,852; ansic: 173; makefile: 3
file content (31 lines) | stat: -rw-r--r-- 460 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#if ISPTR_USE_PYTHON

#if ISPTR_USE_MODULES
    import isptr;

    #define PY_SSIZE_T_CLEAN
    #include <Python.h>
#else
    #define PY_SSIZE_T_CLEAN
    #include <intrusive_shared_ptr/python_ptr.h>
#endif

#include <doctest/doctest.h>

using namespace isptr;

TEST_SUITE("python") {

TEST_CASE( "Python Ptr" ) {
    
    auto str = py_attach(PyUnicode_FromString("Hello"));
    REQUIRE(str);
    CHECK( PyUnicode_GetLength(str.get()) == 5 );
}

}

#endif