File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ PYTHON_CFLAGS=-Wall -I $(CPYTHON_SRC) -I $(CPYTHON_SRC)/Include
44PYTHON_LDFLAGS =-l $(LIBPYTHON ) -L $(CPYTHON_SRC )
55CFLAGS =$(shell pkg-config check --cflags) $(PYTHON_CFLAGS )
66LDFLAGS =$(shell pkg-config check --libs) $(PYTHON_LDFLAGS )
7- SOURCES =runtests.c test_tuple.c
7+ SOURCES =runtests.c test_object.c test_tuple.c
88
99.PHONY : test_fullapi test_newcapi test_no_borrow
1010.NOTPARALLEL : test_fullapi test_newcapi test_no_borrow
Original file line number Diff line number Diff line change 22#include <check.h>
33#include <Python.h>
44
5+ void register_PyObject (Suite * s );
56void register_PyTuple (Suite * s );
67
78int main (void )
@@ -18,6 +19,7 @@ int main(void)
1819#endif
1920
2021 Suite * s = suite_create ("CAPI" );
22+ register_PyObject (s );
2123 register_PyTuple (s );
2224 SRunner * sr = srunner_create (s );
2325
Original file line number Diff line number Diff line change 1+ /* Test PyObject API */
2+
3+ #include <stdlib.h>
4+ #include <check.h>
5+ #include <Python.h>
6+
7+
8+ START_TEST (test_Py_INCREF )
9+ {
10+ PyObject * obj = Py_None ;
11+ Py_ssize_t refcnt = Py_REFCNT (obj );
12+
13+ Py_INCREF (obj );
14+ ck_assert_int_eq (Py_REFCNT (obj ), refcnt + 1 );
15+
16+ Py_DECREF (obj );
17+ }
18+ END_TEST
19+
20+
21+ START_TEST (test_Py_DECREF )
22+ {
23+ PyObject * obj = Py_None ;
24+ Py_INCREF (obj );
25+ Py_ssize_t refcnt = Py_REFCNT (obj );
26+
27+ Py_DECREF (obj );
28+ ck_assert_int_eq (Py_REFCNT (obj ), refcnt - 1 );
29+ }
30+ END_TEST
31+
32+
33+ void register_PyObject (Suite * s )
34+ {
35+ TCase * testcase = tcase_create ("PyObject" );
36+ tcase_add_test (testcase , test_Py_INCREF );
37+ tcase_add_test (testcase , test_Py_DECREF );
38+ suite_add_tcase (s , testcase );
39+ }
You can’t perform that action at this time.
0 commit comments