Skip to content

Commit 51e49a3

Browse files
committed
Add testing to non-SP pointers
1 parent 9e63bed commit 51e49a3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Examples/test-suite/fortran/fortran_ownership_runme.F90

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ subroutine test_standard
5656
ASSERT(.not. btest(b%swigdata%cmemflags, swig_cmem_rvalue_bit))
5757
ASSERT(foo_counter == 3)
5858

59+
! Return null
60+
call b%release()
61+
b = get_null()
62+
ASSERT(.not. c_associated(b%swigdata%cptr))
63+
5964
! Capture from function
6065
b = make_foo(6)
6166
ASSERT(btest(b%swigdata%cmemflags, swig_cmem_own_bit))

Examples/test-suite/fortran_ownership.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Foo& reference(Foo& other) { return other; }
4343
const Foo& const_reference(const Foo& other) { return other; }
4444
Foo make_foo(int val) { return Foo(val); }
4545
Foo make_foo_subroutine(int val) { return Foo(val); }
46+
Foo* get_null() { return NULL; }
4647

4748
int get_value(const Foo& other) { return other.val; }
4849
int get_value_copy(Foo other) { return other.val; }

0 commit comments

Comments
 (0)