Add test for null pointer handling ([] taken as null pointer).
Support automatic single cell dereferencing. Add test for it and pass-through cell arrays. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10379 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
dda6df974f
commit
e7894a104b
7 changed files with 52 additions and 6 deletions
|
|
@ -13,7 +13,9 @@ srcdir = @srcdir@
|
|||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
#CPP_TEST_CASES +=
|
||||
CPP_TEST_CASES += \
|
||||
null_pointer \
|
||||
cell_deref
|
||||
|
||||
CPP_TEST_BROKEN += \
|
||||
implicittest \
|
||||
|
|
|
|||
15
Examples/test-suite/octave/cell_deref.i
Normal file
15
Examples/test-suite/octave/cell_deref.i
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
%module cell_deref
|
||||
|
||||
%inline {
|
||||
bool func(const char* s) {
|
||||
return !strcmp("hello",s);
|
||||
}
|
||||
|
||||
Cell func2() {
|
||||
Cell c(1,2);
|
||||
c(0) = "hello";
|
||||
c(1) = 4;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
8
Examples/test-suite/octave/cell_deref_runme.m
Normal file
8
Examples/test-suite/octave/cell_deref_runme.m
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
cell_deref;
|
||||
|
||||
assert(func("hello"));
|
||||
assert(func({"hello"}));
|
||||
|
||||
c = func2();
|
||||
assert(strcmp(c{1}, "hello"));
|
||||
assert(c{2} == 4);
|
||||
10
Examples/test-suite/octave/null_pointer.i
Normal file
10
Examples/test-suite/octave/null_pointer.i
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
%module null_pointer
|
||||
|
||||
%inline {
|
||||
struct A {};
|
||||
|
||||
bool func(A* a) {
|
||||
return !a;
|
||||
}
|
||||
}
|
||||
|
||||
3
Examples/test-suite/octave/null_pointer_runme.m
Normal file
3
Examples/test-suite/octave/null_pointer_runme.m
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
null_pointer;
|
||||
|
||||
assert(func([]));
|
||||
Loading…
Add table
Add a link
Reference in a new issue