modify test-suite (barring python atm) to not rely on the -I path to find the input .i file - removes the new warning 125 and sets up the test-suite for testing with ccache. This change required the use of -outcurrentdir and moving the .i files from the language subdirectories to the directory above along with some .i file name changes.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10949 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
53f786e5a6
commit
db83e51441
61 changed files with 390 additions and 709 deletions
|
|
@ -19,7 +19,7 @@ SKIP_CPP_STD_CASES = Yes
|
|||
|
||||
CPP_TEST_CASES += li_std_string
|
||||
|
||||
EXTRA_TEST_CASES += ext_test.externaltest
|
||||
EXTRA_TEST_CASES += chicken_ext_test.externaltest
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(load "ext_test.so")
|
||||
(load "chicken_ext_test.so")
|
||||
|
||||
(define a (test-create))
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module ext_test
|
||||
%module chicken_ext_test
|
||||
|
||||
/* just use the imports_a.h header... for this test we only need a class */
|
||||
%{
|
||||
|
|
@ -59,11 +59,12 @@ CXXSRCS =
|
|||
CSRCS =
|
||||
TARGETPREFIX =
|
||||
TARGETSUFFIX =
|
||||
SWIGOPT = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$(LANGUAGE) -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE) -DSWIG_NOEXTRA_QUALIFICATION
|
||||
INCLUDES = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$(LANGUAGE) -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
|
||||
SWIGOPT = -outcurrentdir -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
|
||||
INCLUDES = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
|
||||
LIBS = -L.
|
||||
LIBPREFIX = lib
|
||||
ACTION = check
|
||||
INTERFACEDIR = ../
|
||||
|
||||
#
|
||||
# Please keep test cases in alphabetical order.
|
||||
|
|
@ -405,6 +406,7 @@ CPP_STD_TEST_CASES += \
|
|||
template_typedef_fnc \
|
||||
template_type_namespace \
|
||||
template_opaque
|
||||
# li_std_list
|
||||
|
||||
|
||||
ifndef SKIP_CPP_STD_CASES
|
||||
|
|
@ -441,11 +443,13 @@ C_TEST_CASES += \
|
|||
overload_extendc \
|
||||
preproc \
|
||||
ret_by_value \
|
||||
simple_array \
|
||||
sizeof_pointer \
|
||||
sneaky1 \
|
||||
struct_rename \
|
||||
typedef_struct \
|
||||
typemap_subst \
|
||||
union \
|
||||
unions
|
||||
|
||||
|
||||
|
|
@ -491,14 +495,14 @@ swig_and_compile_cpp = \
|
|||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
|
||||
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACE="$*.i" \
|
||||
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
|
||||
$(LANGUAGE)$(VARIANT)_cpp
|
||||
|
||||
swig_and_compile_c = \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CSRCS="$(CSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
|
||||
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACE="$*.i" \
|
||||
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
|
||||
$(LANGUAGE)$(VARIANT)
|
||||
|
||||
swig_and_compile_multi_cpp = \
|
||||
|
|
@ -506,7 +510,7 @@ swig_and_compile_multi_cpp = \
|
|||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
|
||||
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACE="$$f.i" \
|
||||
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
|
||||
$(LANGUAGE)$(VARIANT)_cpp; \
|
||||
done
|
||||
|
||||
|
|
@ -518,7 +522,7 @@ swig_and_compile_external = \
|
|||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS) $*_external.cxx" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
|
||||
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACE="$*.i" \
|
||||
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
|
||||
$(LANGUAGE)$(VARIANT)_cpp
|
||||
|
||||
swig_and_compile_runtime = \
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ include $(srcdir)/../common.mk
|
|||
|
||||
# Overridden variables here
|
||||
SWIGOPT += -namespace $*Namespace $(SWIGOPTSPECIAL)
|
||||
INTERFACEDIR = ../../
|
||||
|
||||
CSHARPFLAGSSPECIAL =
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# Makefile for guile test-suite (with SCM API)
|
||||
#######################################################################
|
||||
|
||||
EXTRA_TEST_CASES += ext_test.externaltest
|
||||
EXTRA_TEST_CASES += guilescm_ext_test.externaltest
|
||||
|
||||
include ../guile/Makefile
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(dynamic-call "scm_init_ext_test_module" (dynamic-link "./libext_test.so"))
|
||||
(dynamic-call "scm_init_guilescm_ext_test_module" (dynamic-link "./libguilescm_ext_test.so"))
|
||||
|
||||
; This is a test for SF Bug 1573892
|
||||
; If IsPointer is called before TypeQuery, the test-is-pointer will fail
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module ext_test
|
||||
%module guilescm_ext_test
|
||||
|
||||
/* just use the imports_a.h header... for this test we only need a class */
|
||||
%{
|
||||
|
|
@ -37,6 +37,7 @@ include $(srcdir)/../common.mk
|
|||
|
||||
# Overridden variables here
|
||||
SWIGOPT += -package $*
|
||||
INTERFACEDIR = ../../
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
|
|
@ -72,7 +73,7 @@ run_testcase = \
|
|||
(cd $* && $(COMPILETOOL) $(JAVAC) -classpath . *.java) && \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
$(COMPILETOOL) $(JAVAC) -classpath . -d . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_LIBRARY_PATH="$*:$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) -classpath . $*\_runme;) \
|
||||
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_LIBRARY_PATH="$*:$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) -classpath . $*_runme;) \
|
||||
fi;
|
||||
|
||||
# Clean: remove testcase directories
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%module li_std_pair
|
||||
%module li_std_pair_extra
|
||||
|
||||
//
|
||||
// activate the automatic comparison methods generation (==,!=,...)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module li_std_string
|
||||
%module li_std_string_extra
|
||||
|
||||
%naturalvar A;
|
||||
|
||||
|
|
@ -51,5 +51,5 @@ std::basic_string<char,std::char_traits<char>,std::allocator<char> > test_value_
|
|||
|
||||
%}
|
||||
|
||||
%include ../li_std_string.i
|
||||
%include "li_std_string.i"
|
||||
|
||||
|
|
@ -10,7 +10,9 @@ top_srcdir = @top_srcdir@
|
|||
top_builddir = @top_builddir@
|
||||
|
||||
CPP_TEST_CASES += \
|
||||
cell_deref
|
||||
li_std_pair_extra \
|
||||
li_std_string_extra \
|
||||
octave_cell_deref
|
||||
|
||||
CPP_TEST_BROKEN += \
|
||||
implicittest \
|
||||
|
|
|
|||
69
Examples/test-suite/octave/li_std_pair_extra_runme.m
Normal file
69
Examples/test-suite/octave/li_std_pair_extra_runme.m
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
li_std_pair_extra
|
||||
|
||||
p = {1,2};
|
||||
p1 = li_std_pair_extra.p_inout(p);
|
||||
assert(all(cell2mat(p1)==[2,1]));
|
||||
p2 = li_std_pair_extra.p_inoutd(p1);
|
||||
assert(all(cell2mat(p2)==[1,2]));
|
||||
|
||||
d1 = li_std_pair_extra.d_inout(2);
|
||||
assert(d1==4);
|
||||
|
||||
[i,d2] = li_std_pair_extra.d_inout2(2);
|
||||
assert(all([i,d2]==[1,4]));
|
||||
|
||||
[i,p] = li_std_pair_extra.p_inout2(p);
|
||||
assert(i==1&&all([cell2mat(p)]==[2,1]));
|
||||
[p3,p4] = li_std_pair_extra.p_inout3(p1,p1);
|
||||
assert(all(cell2mat(p3)==[2,1]));
|
||||
assert(all(cell2mat(p4)==[2,1]));
|
||||
|
||||
psi = li_std_pair_extra.SIPair("hello",1);
|
||||
assert(psi=={"hello",1});
|
||||
pci = li_std_pair_extra.CIPair(complex(1,2),1);
|
||||
assert(pci.first==complex(1,2)&&pci.second==1);
|
||||
|
||||
|
||||
psi = li_std_pair_extra.SIPair("hi",1);
|
||||
assert(psi.first=="hi"&&psi.second==1);
|
||||
|
||||
psii = li_std_pair_extra.SIIPair(psi,1);
|
||||
assert(psii.first.first=="hi");
|
||||
assert(psii.first.second==1);
|
||||
assert(psii.second==1);
|
||||
|
||||
a = li_std_pair_extra.A();
|
||||
b = li_std_pair_extra.B();
|
||||
|
||||
pab = li_std_pair_extra.ABPair(a,b);
|
||||
|
||||
pab.first = a;
|
||||
pab.first.val = 2;
|
||||
|
||||
assert(pab.first.val == 2);
|
||||
|
||||
pci = li_std_pair_extra.CIntPair(1,0);
|
||||
assert(pci.first==1&&pci.second==0);
|
||||
|
||||
a = li_std_pair_extra.A(5);
|
||||
p1 = li_std_pair_extra.pairP1(1,a);
|
||||
p2 = li_std_pair_extra.pairP2(a,1);
|
||||
p3 = li_std_pair_extra.pairP3(a,a);
|
||||
|
||||
assert(a.val == li_std_pair_extra.p_identa(p1){2}.val);
|
||||
|
||||
p = li_std_pair_extra.IntPair(1,10);
|
||||
assert(p.first==1&&p.second==10);
|
||||
p.first = 1;
|
||||
assert(p.first==1);
|
||||
|
||||
p = li_std_pair_extra.paircA1(1,a);
|
||||
assert(p.first==1);
|
||||
assert(swig_this(p.second)==swig_this(a));
|
||||
|
||||
p = li_std_pair_extra.paircA2(1,a);
|
||||
assert(p.first==1);
|
||||
assert(swig_this(p.second)==swig_this(a));
|
||||
#pp = li_std_pair_extra.pairiiA(1,p); # conversion pb re const of pairA1/A2
|
||||
pp = li_std_pair_extra.pairiiA(1,{1,A()});
|
||||
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
li_std_pair
|
||||
|
||||
p = {1,2};
|
||||
p1 = li_std_pair.p_inout(p);
|
||||
assert(all(cell2mat(p1)==[2,1]));
|
||||
p2 = li_std_pair.p_inoutd(p1);
|
||||
assert(all(cell2mat(p2)==[1,2]));
|
||||
|
||||
d1 = li_std_pair.d_inout(2);
|
||||
assert(d1==4);
|
||||
|
||||
[i,d2] = li_std_pair.d_inout2(2);
|
||||
assert(all([i,d2]==[1,4]));
|
||||
|
||||
[i,p] = li_std_pair.p_inout2(p);
|
||||
assert(i==1&&all([cell2mat(p)]==[2,1]));
|
||||
[p3,p4] = li_std_pair.p_inout3(p1,p1);
|
||||
assert(all(cell2mat(p3)==[2,1]));
|
||||
assert(all(cell2mat(p4)==[2,1]));
|
||||
|
||||
psi = li_std_pair.SIPair("hello",1);
|
||||
assert(psi=={"hello",1});
|
||||
pci = li_std_pair.CIPair(complex(1,2),1);
|
||||
assert(pci.first==complex(1,2)&&pci.second==1);
|
||||
|
||||
|
||||
psi = li_std_pair.SIPair("hi",1);
|
||||
assert(psi.first=="hi"&&psi.second==1);
|
||||
|
||||
psii = li_std_pair.SIIPair(psi,1);
|
||||
assert(psii.first.first=="hi");
|
||||
assert(psii.first.second==1);
|
||||
assert(psii.second==1);
|
||||
|
||||
a = li_std_pair.A();
|
||||
b = li_std_pair.B();
|
||||
|
||||
pab = li_std_pair.ABPair(a,b);
|
||||
|
||||
pab.first = a;
|
||||
pab.first.val = 2;
|
||||
|
||||
assert(pab.first.val == 2);
|
||||
|
||||
pci = li_std_pair.CIntPair(1,0);
|
||||
assert(pci.first==1&&pci.second==0);
|
||||
|
||||
a = li_std_pair.A(5);
|
||||
p1 = li_std_pair.pairP1(1,a);
|
||||
p2 = li_std_pair.pairP2(a,1);
|
||||
p3 = li_std_pair.pairP3(a,a);
|
||||
|
||||
assert(a.val == li_std_pair.p_identa(p1){2}.val);
|
||||
|
||||
p = li_std_pair.IntPair(1,10);
|
||||
assert(p.first==1&&p.second==10);
|
||||
p.first = 1;
|
||||
assert(p.first==1);
|
||||
|
||||
p = li_std_pair.paircA1(1,a);
|
||||
assert(p.first==1);
|
||||
assert(swig_this(p.second)==swig_this(a));
|
||||
|
||||
p = li_std_pair.paircA2(1,a);
|
||||
assert(p.first==1);
|
||||
assert(swig_this(p.second)==swig_this(a));
|
||||
#pp = li_std_pair.pairiiA(1,p); # conversion pb re const of pairA1/A2
|
||||
pp = li_std_pair.pairiiA(1,{1,A()});
|
||||
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
%module li_std_string
|
||||
|
||||
%naturalvar A;
|
||||
|
||||
|
||||
%include <std_basic_string.i>
|
||||
%include <std_string.i>
|
||||
|
||||
|
||||
%inline %{
|
||||
|
||||
struct A : std::string
|
||||
{
|
||||
A(const std::string& s) : std::string(s)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct B
|
||||
{
|
||||
B(const std::string& s) : cname(0), name(s), a(s)
|
||||
{
|
||||
}
|
||||
|
||||
char *cname;
|
||||
std::string name;
|
||||
A a;
|
||||
|
||||
};
|
||||
|
||||
|
||||
const char* test_ccvalue(const char* x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
char* test_cvalue(char* x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
std::basic_string<char> test_value_basic1(std::basic_string<char> x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
std::basic_string<char,std::char_traits<char> > test_value_basic2(std::basic_string<char,std::char_traits<char> > x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
std::basic_string<char,std::char_traits<char>,std::allocator<char> > test_value_basic3(std::basic_string<char,std::char_traits<char>,std::allocator<char> > x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%include ../li_std_string.i
|
||||
|
||||
|
|
@ -1,27 +1,27 @@
|
|||
li_std_string
|
||||
li_std_string_extra
|
||||
|
||||
x="hello";
|
||||
|
||||
|
||||
|
||||
if (li_std_string.test_ccvalue(x) != x)
|
||||
if (li_std_string_extra.test_ccvalue(x) != x)
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
if (li_std_string.test_cvalue(x) != x)
|
||||
if (li_std_string_extra.test_cvalue(x) != x)
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
if (li_std_string.test_value(x) != x)
|
||||
error("bad string mapping: %s, %s", x, li_std_string.test_value(x))
|
||||
if (li_std_string_extra.test_value(x) != x)
|
||||
error("bad string mapping: %s, %s", x, li_std_string_extra.test_value(x))
|
||||
endif
|
||||
|
||||
if (li_std_string.test_const_reference(x) != x)
|
||||
if (li_std_string_extra.test_const_reference(x) != x)
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
|
||||
s = li_std_string.string("he");
|
||||
s = li_std_string_extra.string("he");
|
||||
#s += "ll"
|
||||
#s.append('o')
|
||||
s = s + "llo";
|
||||
|
|
@ -34,25 +34,25 @@ if (s[1:4] != x[1:4])
|
|||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
if (li_std_string.test_value(s) != x)
|
||||
if (li_std_string_extra.test_value(s) != x)
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
if (li_std_string.test_const_reference(s) != x)
|
||||
if (li_std_string_extra.test_const_reference(s) != x)
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
a = li_std_string.A(s);
|
||||
a = li_std_string_extra.A(s);
|
||||
|
||||
if (li_std_string.test_value(a) != x)
|
||||
if (li_std_string_extra.test_value(a) != x)
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
if (li_std_string.test_const_reference(a) != x)
|
||||
if (li_std_string_extra.test_const_reference(a) != x)
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
b = li_std_string.string(" world");
|
||||
b = li_std_string_extra.string(" world");
|
||||
|
||||
s = a + b;
|
||||
if (a + b != "hello world")
|
||||
|
|
@ -74,48 +74,48 @@ endif
|
|||
|
||||
s = "hello world";
|
||||
|
||||
b = li_std_string.B("hi");
|
||||
b = li_std_string_extra.B("hi");
|
||||
|
||||
b.name = li_std_string.string("hello");
|
||||
b.name = li_std_string_extra.string("hello");
|
||||
if (b.name != "hello")
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
|
||||
b.a = li_std_string.A("hello");
|
||||
b.a = li_std_string_extra.A("hello");
|
||||
if (b.a != "hello")
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
|
||||
if (li_std_string.test_value_basic1(x) != x)
|
||||
if (li_std_string_extra.test_value_basic1(x) != x)
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
if (li_std_string.test_value_basic2(x) != x)
|
||||
if (li_std_string_extra.test_value_basic2(x) != x)
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
|
||||
if (li_std_string.test_value_basic3(x) != x)
|
||||
if (li_std_string_extra.test_value_basic3(x) != x)
|
||||
error("bad string mapping")
|
||||
endif
|
||||
|
||||
# Global variables
|
||||
s = "initial string";
|
||||
if (li_std_string.cvar.GlobalString2 != "global string 2")
|
||||
if (li_std_string_extra.cvar.GlobalString2 != "global string 2")
|
||||
error("GlobalString2 test 1")
|
||||
endif
|
||||
li_std_string.cvar.GlobalString2 = s;
|
||||
if (li_std_string.cvar.GlobalString2 != s)
|
||||
li_std_string_extra.cvar.GlobalString2 = s;
|
||||
if (li_std_string_extra.cvar.GlobalString2 != s)
|
||||
error("GlobalString2 test 2")
|
||||
endif
|
||||
if (li_std_string.cvar.ConstGlobalString != "const global string")
|
||||
if (li_std_string_extra.cvar.ConstGlobalString != "const global string")
|
||||
error("ConstGlobalString test")
|
||||
endif
|
||||
|
||||
# Member variables
|
||||
myStructure = li_std_string.Structure();
|
||||
myStructure = li_std_string_extra.Structure();
|
||||
if (myStructure.MemberString2 != "member string 2")
|
||||
error("MemberString2 test 1")
|
||||
endif
|
||||
|
|
@ -127,36 +127,36 @@ if (myStructure.ConstMemberString != "const member string")
|
|||
error("ConstMemberString test")
|
||||
endif
|
||||
|
||||
if (li_std_string.cvar.Structure_StaticMemberString2 != "static member string 2")
|
||||
if (li_std_string_extra.cvar.Structure_StaticMemberString2 != "static member string 2")
|
||||
error("StaticMemberString2 test 1")
|
||||
endif
|
||||
li_std_string.cvar.Structure_StaticMemberString2 = s;
|
||||
if (li_std_string.cvar.Structure_StaticMemberString2 != s)
|
||||
li_std_string_extra.cvar.Structure_StaticMemberString2 = s;
|
||||
if (li_std_string_extra.cvar.Structure_StaticMemberString2 != s)
|
||||
error("StaticMemberString2 test 2")
|
||||
endif
|
||||
if (li_std_string.cvar.Structure_ConstStaticMemberString != "const static member string")
|
||||
if (li_std_string_extra.cvar.Structure_ConstStaticMemberString != "const static member string")
|
||||
error("ConstStaticMemberString test")
|
||||
endif
|
||||
|
||||
|
||||
if (li_std_string.test_reference_input("hello") != "hello")
|
||||
if (li_std_string_extra.test_reference_input("hello") != "hello")
|
||||
error
|
||||
endif
|
||||
s = li_std_string.test_reference_inout("hello");
|
||||
s = li_std_string_extra.test_reference_inout("hello");
|
||||
if (s != "hellohello")
|
||||
error
|
||||
endif
|
||||
|
||||
|
||||
if (li_std_string.stdstring_empty() != "")
|
||||
if (li_std_string_extra.stdstring_empty() != "")
|
||||
error
|
||||
endif
|
||||
|
||||
|
||||
if (li_std_string.c_empty() != "")
|
||||
if (li_std_string_extra.c_empty() != "")
|
||||
error
|
||||
endif
|
||||
|
||||
if (li_std_string.c_null() != None)
|
||||
if (li_std_string_extra.c_null() != None)
|
||||
error
|
||||
endif
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
cell_deref;
|
||||
octave_cell_deref;
|
||||
|
||||
assert(func("hello"));
|
||||
assert(func({"hello"}));
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module cell_deref
|
||||
%module octave_cell_deref
|
||||
|
||||
%inline {
|
||||
bool func(const char* s) {
|
||||
|
|
@ -8,6 +8,9 @@ srcdir = @srcdir@
|
|||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
#CPP_TEST_CASES += \
|
||||
# php_namewarn_rename \
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Overridden variables here
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%module namewarn_rename
|
||||
%module php_namewarn_rename
|
||||
|
||||
|
||||
%inline %{
|
||||
|
|
@ -52,8 +52,10 @@ CPP_TEST_CASES += \
|
|||
li_implicit \
|
||||
li_std_vectora \
|
||||
li_std_map \
|
||||
li_std_pair_extra \
|
||||
li_std_set \
|
||||
li_std_stream \
|
||||
li_std_string_extra \
|
||||
li_std_wstream \
|
||||
li_std_wstring \
|
||||
nondynamic \
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
%module(naturalvar="1") implicittest
|
||||
|
||||
%implicitconv;
|
||||
|
||||
%inline
|
||||
{
|
||||
struct B { };
|
||||
}
|
||||
|
||||
%inline
|
||||
{
|
||||
struct A
|
||||
{
|
||||
int ii;
|
||||
A(int i) { ii = 1; }
|
||||
A(double d) { ii = 2; }
|
||||
A(const B& b) { ii = 3; }
|
||||
explicit A(char *s) { ii = 4; }
|
||||
|
||||
int get() const { return ii; }
|
||||
|
||||
};
|
||||
|
||||
int get(const A& a) { return a.ii; }
|
||||
|
||||
template <class T>
|
||||
struct A_T
|
||||
{
|
||||
int ii;
|
||||
A_T(int i) { ii = 1; }
|
||||
A_T(double d) { ii = 2; }
|
||||
A_T(const B& b) { ii = 3; }
|
||||
explicit A_T(char *s) { ii = 4; }
|
||||
|
||||
int get() const { return ii; }
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
%inline
|
||||
{
|
||||
struct Foo
|
||||
{
|
||||
int ii;
|
||||
Foo(){ ii = 0;}
|
||||
Foo(int){ ii = 1;}
|
||||
Foo(double){ ii = 2;}
|
||||
explicit Foo(char *s){ii = 3;}
|
||||
Foo(const Foo& f){ ii = f.ii;}
|
||||
|
||||
};
|
||||
|
||||
struct Bar
|
||||
{
|
||||
int ii;
|
||||
Foo f;
|
||||
Bar() {ii = -1;}
|
||||
Bar(const Foo& ff){ ii = ff.ii;}
|
||||
};
|
||||
|
||||
|
||||
int get_b(const Bar&b) { return b.ii; }
|
||||
|
||||
Foo foo;
|
||||
|
||||
}
|
||||
|
||||
%template(A_int) A_T<int>;
|
||||
|
|
@ -1,210 +0,0 @@
|
|||
%module li_std_pair
|
||||
|
||||
//
|
||||
// activate the automatic comparison methods generation (==,!=,...)
|
||||
//
|
||||
|
||||
%{
|
||||
#include <algorithm> // for std::swap
|
||||
%}
|
||||
|
||||
|
||||
%include std_pair.i
|
||||
%include std_string.i
|
||||
%include std_complex.i
|
||||
|
||||
%inline
|
||||
%{
|
||||
struct A
|
||||
{
|
||||
int val;
|
||||
|
||||
A(int v = 0): val(v)
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
struct B
|
||||
{
|
||||
};
|
||||
%}
|
||||
|
||||
%std_comp_methods(std::pair<std::string, int>);
|
||||
|
||||
namespace std {
|
||||
%template(CIntPair) pair<const int, const int>;
|
||||
%template() pair<double, double>;
|
||||
%template(ShortPair) pair<short, short>;
|
||||
|
||||
%template(IntPair) pair<int, int>;
|
||||
%extend pair<int, int>
|
||||
{
|
||||
%template(pair) pair<short,short>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
%template(SIPair) pair<std::string, int>;
|
||||
%template(CIPair) pair<std::complex<double>, int>;
|
||||
%template(SIIPair) pair<std::pair<std::string, int>, int>;
|
||||
%template(AIntPair) pair<A, int>;
|
||||
|
||||
%template(CCIntPair) pair<const A, const pair<int, int> >;
|
||||
|
||||
%template(ABPair) pair<A, B>;
|
||||
%template(IntAPair) pair<int, A>;
|
||||
|
||||
%template(pairP1) pair<int, A*>;
|
||||
%template(pairP2) pair<A*, int>;
|
||||
%template(pairP3) pair<A*, A*>;
|
||||
%template(pairP4) pair<int, int*>;
|
||||
%template(pairP5) pair<int*, int>;
|
||||
%template(pairP6) pair<int*, int*>;
|
||||
|
||||
}
|
||||
%std_comp_methods(std::pair<std::pair<std::string, int>, int>);
|
||||
|
||||
%apply std::pair<int,int> *INOUT {std::pair<int,int> *INOUT2};
|
||||
|
||||
%inline %{
|
||||
|
||||
/* Test the "out" typemap for pair<T, U> */
|
||||
std::pair<int, int> makeIntPair(int a, int b) {
|
||||
return std::make_pair(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* There is no "out" typemap for a pointer to a pair, so
|
||||
* this should return a wrapped instance of a std::pair
|
||||
* instead of the native "array" type for the target language.
|
||||
*/
|
||||
std::pair<int, int> * makeIntPairPtr(int a, int b) {
|
||||
static std::pair<int, int> p = std::make_pair(a, b);
|
||||
return &p;
|
||||
}
|
||||
|
||||
/**
|
||||
* There is no "out" typemap for a non-const reference to a pair, so
|
||||
* this should return a wrapped instance of a std::pair instead of
|
||||
* the native "array" type for the target language.
|
||||
*/
|
||||
std::pair<int, int>& makeIntPairRef(int a, int b) {
|
||||
static std::pair<int, int> p = std::make_pair(a, b);
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* There is no "out" typemap for a const reference to a pair, so
|
||||
* this should return a wrapped instance of a std::pair
|
||||
* instead of the native "array" type for the target language.
|
||||
*/
|
||||
const std::pair<int, int> & makeIntPairConstRef(int a, int b) {
|
||||
static std::pair<int, int> p = std::make_pair(a, b);
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Test the "in" typemap for pair<T, U> */
|
||||
int product1(std::pair<int, int> p) {
|
||||
return p.first*p.second;
|
||||
}
|
||||
|
||||
/* Test the "in" typemap for const pair<T, U>& */
|
||||
int product2(const std::pair<int, int>& p) {
|
||||
return p.first*p.second;
|
||||
}
|
||||
|
||||
std::pair<int, int>
|
||||
p_ident(std::pair<int, int> p, const std::pair<int, int>& q) {
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
std::pair<int, A*>
|
||||
p_identa(const std::pair<int, A*>& p) {
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
d_inout(double *INOUT) {
|
||||
*INOUT += *INOUT;
|
||||
}
|
||||
|
||||
void
|
||||
d_inout(int *INOUT) {
|
||||
*INOUT += *INOUT;
|
||||
}
|
||||
|
||||
int
|
||||
d_inout2(double *INOUT) {
|
||||
*INOUT += *INOUT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
p_inout(std::pair<int, int> *INOUT) {
|
||||
std::swap(INOUT->first, INOUT->second);
|
||||
}
|
||||
|
||||
int
|
||||
p_inout2(std::pair<int, int> *INOUT) {
|
||||
std::swap(INOUT->first, INOUT->second);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
p_inout3(std::pair<int,int> *INOUT, std::pair<int,int> *INOUT2) {
|
||||
std::swap(*INOUT, *INOUT2);
|
||||
}
|
||||
|
||||
void
|
||||
p_inoutd(std::pair<double, double> *INOUT) {
|
||||
std::swap(INOUT->first, INOUT->second);
|
||||
}
|
||||
|
||||
std::string
|
||||
s_ident(const std::string& s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
#if 0
|
||||
std::pair<char, char>
|
||||
p_ident(std::pair<char, char> p, const std::pair<char, char>& q) {
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Test the "in" typemap for const pair<T, U>* */
|
||||
std::pair<A, B>
|
||||
p_ident(std::pair<A, B> p, const std::pair<A, B>& q) {
|
||||
return q;
|
||||
}
|
||||
|
||||
/* Test the "in" typemap for const pair<T, U>* */
|
||||
std::pair<int, A>
|
||||
p_ident(std::pair<int, A> p, const std::pair<int, A>& q) {
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
std::pair<int, int>
|
||||
p_ident(std::pair<int, int> p, const std::pair<A, int>& q) {
|
||||
return p;
|
||||
}
|
||||
|
||||
std::pair<int, int>
|
||||
p_ident(std::pair<int, int> p, const std::pair<A, B>& q) {
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
%}
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
%template(paircA1) pair<const int, A*>;
|
||||
%template(paircA2) pair<const int, const A*>;
|
||||
%template(pairiiA) pair<int,pair<int, A*> >;
|
||||
}
|
||||
|
||||
59
Examples/test-suite/python/li_std_pair_extra_runme.py
Normal file
59
Examples/test-suite/python/li_std_pair_extra_runme.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import li_std_pair_extra
|
||||
|
||||
p = (1,2)
|
||||
p1 = li_std_pair_extra.p_inout(p)
|
||||
p2 = li_std_pair_extra.p_inoutd(p1)
|
||||
|
||||
d1 = li_std_pair_extra.d_inout(2)
|
||||
|
||||
i,d2 = li_std_pair_extra.d_inout2(2)
|
||||
|
||||
i,p = li_std_pair_extra.p_inout2(p)
|
||||
p3,p4 = li_std_pair_extra.p_inout3(p1,p1)
|
||||
|
||||
psi = li_std_pair_extra.SIPair("hello",1)
|
||||
pci = li_std_pair_extra.CIPair(1,1)
|
||||
|
||||
|
||||
#psi.first = "hi"
|
||||
|
||||
|
||||
psi = li_std_pair_extra.SIPair("hi",1)
|
||||
if psi != ("hi",1):
|
||||
raise RuntimeError
|
||||
|
||||
psii = li_std_pair_extra.SIIPair(psi,1)
|
||||
|
||||
a = li_std_pair_extra.A()
|
||||
b = li_std_pair_extra.B()
|
||||
|
||||
pab = li_std_pair_extra.ABPair(a,b);
|
||||
|
||||
pab.first = a
|
||||
pab.first.val = 2
|
||||
|
||||
if pab.first.val != 2:
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
pci = li_std_pair_extra.CIntPair(1,0)
|
||||
|
||||
a = li_std_pair_extra.A(5)
|
||||
p1 = li_std_pair_extra.pairP1(1,a.this)
|
||||
p2 = li_std_pair_extra.pairP2(a,1)
|
||||
p3 = li_std_pair_extra.pairP3(a,a)
|
||||
|
||||
|
||||
if a.val != li_std_pair_extra.p_identa(p1.this)[1].val:
|
||||
raise RuntimeError
|
||||
|
||||
p = li_std_pair_extra.IntPair(1,10)
|
||||
p.first = 1
|
||||
|
||||
p = li_std_pair_extra.paircA1(1,a)
|
||||
p.first
|
||||
p.second
|
||||
|
||||
p = li_std_pair_extra.paircA2(1,a)
|
||||
pp = li_std_pair_extra.pairiiA(1,p)
|
||||
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
import li_std_pair
|
||||
|
||||
p = (1,2)
|
||||
p1 = li_std_pair.p_inout(p)
|
||||
p2 = li_std_pair.p_inoutd(p1)
|
||||
|
||||
d1 = li_std_pair.d_inout(2)
|
||||
|
||||
i,d2 = li_std_pair.d_inout2(2)
|
||||
|
||||
i,p = li_std_pair.p_inout2(p)
|
||||
p3,p4 = li_std_pair.p_inout3(p1,p1)
|
||||
|
||||
psi = li_std_pair.SIPair("hello",1)
|
||||
pci = li_std_pair.CIPair(1,1)
|
||||
|
||||
|
||||
#psi.first = "hi"
|
||||
|
||||
|
||||
psi = li_std_pair.SIPair("hi",1)
|
||||
if psi != ("hi",1):
|
||||
raise RuntimeError
|
||||
|
||||
psii = li_std_pair.SIIPair(psi,1)
|
||||
|
||||
a = li_std_pair.A()
|
||||
b = li_std_pair.B()
|
||||
|
||||
pab = li_std_pair.ABPair(a,b);
|
||||
|
||||
pab.first = a
|
||||
pab.first.val = 2
|
||||
|
||||
if pab.first.val != 2:
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
pci = li_std_pair.CIntPair(1,0)
|
||||
|
||||
a = li_std_pair.A(5)
|
||||
p1 = li_std_pair.pairP1(1,a.this)
|
||||
p2 = li_std_pair.pairP2(a,1)
|
||||
p3 = li_std_pair.pairP3(a,a)
|
||||
|
||||
|
||||
if a.val != li_std_pair.p_identa(p1.this)[1].val:
|
||||
raise RuntimeError
|
||||
|
||||
p = li_std_pair.IntPair(1,10)
|
||||
p.first = 1
|
||||
|
||||
p = li_std_pair.paircA1(1,a)
|
||||
p.first
|
||||
p.second
|
||||
|
||||
p = li_std_pair.paircA2(1,a)
|
||||
pp = li_std_pair.pairiiA(1,p)
|
||||
|
||||
|
|
@ -1,24 +1,24 @@
|
|||
import li_std_string
|
||||
import li_std_string_extra
|
||||
|
||||
x="hello"
|
||||
|
||||
|
||||
|
||||
if li_std_string.test_ccvalue(x) != x:
|
||||
if li_std_string_extra.test_ccvalue(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
if li_std_string.test_cvalue(x) != x:
|
||||
if li_std_string_extra.test_cvalue(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
if li_std_string.test_value(x) != x:
|
||||
print x, li_std_string.test_value(x)
|
||||
if li_std_string_extra.test_value(x) != x:
|
||||
print x, li_std_string_extra.test_value(x)
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
if li_std_string.test_const_reference(x) != x:
|
||||
if li_std_string_extra.test_const_reference(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
|
||||
s = li_std_string.string("he")
|
||||
s = li_std_string_extra.string("he")
|
||||
#s += "ll"
|
||||
#s.append('o')
|
||||
s = s + "llo"
|
||||
|
|
@ -30,21 +30,21 @@ if s != x:
|
|||
if s[1:4] != x[1:4]:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
if li_std_string.test_value(s) != x:
|
||||
if li_std_string_extra.test_value(s) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
if li_std_string.test_const_reference(s) != x:
|
||||
if li_std_string_extra.test_const_reference(s) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
a = li_std_string.A(s)
|
||||
a = li_std_string_extra.A(s)
|
||||
|
||||
if li_std_string.test_value(a) != x:
|
||||
if li_std_string_extra.test_value(a) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
if li_std_string.test_const_reference(a) != x:
|
||||
if li_std_string_extra.test_const_reference(a) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
b = li_std_string.string(" world")
|
||||
b = li_std_string_extra.string(" world")
|
||||
|
||||
s = a + b
|
||||
if a + b != "hello world":
|
||||
|
|
@ -63,40 +63,40 @@ if c.find_last_of("l") != 9:
|
|||
|
||||
s = "hello world"
|
||||
|
||||
b = li_std_string.B("hi")
|
||||
b = li_std_string_extra.B("hi")
|
||||
|
||||
b.name = li_std_string.string("hello")
|
||||
b.name = li_std_string_extra.string("hello")
|
||||
if b.name != "hello":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
|
||||
b.a = li_std_string.A("hello")
|
||||
b.a = li_std_string_extra.A("hello")
|
||||
if b.a != "hello":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
|
||||
if li_std_string.test_value_basic1(x) != x:
|
||||
if li_std_string_extra.test_value_basic1(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
if li_std_string.test_value_basic2(x) != x:
|
||||
if li_std_string_extra.test_value_basic2(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
|
||||
if li_std_string.test_value_basic3(x) != x:
|
||||
if li_std_string_extra.test_value_basic3(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
# Global variables
|
||||
s = "initial string"
|
||||
if li_std_string.cvar.GlobalString2 != "global string 2":
|
||||
if li_std_string_extra.cvar.GlobalString2 != "global string 2":
|
||||
raise RuntimeError, "GlobalString2 test 1"
|
||||
li_std_string.cvar.GlobalString2 = s
|
||||
if li_std_string.cvar.GlobalString2 != s:
|
||||
li_std_string_extra.cvar.GlobalString2 = s
|
||||
if li_std_string_extra.cvar.GlobalString2 != s:
|
||||
raise RuntimeError, "GlobalString2 test 2"
|
||||
if li_std_string.cvar.ConstGlobalString != "const global string":
|
||||
if li_std_string_extra.cvar.ConstGlobalString != "const global string":
|
||||
raise RuntimeError, "ConstGlobalString test"
|
||||
|
||||
# Member variables
|
||||
myStructure = li_std_string.Structure()
|
||||
myStructure = li_std_string_extra.Structure()
|
||||
if myStructure.MemberString2 != "member string 2":
|
||||
raise RuntimeError, "MemberString2 test 1"
|
||||
myStructure.MemberString2 = s
|
||||
|
|
@ -105,28 +105,28 @@ if myStructure.MemberString2 != s:
|
|||
if myStructure.ConstMemberString != "const member string":
|
||||
raise RuntimeError, "ConstMemberString test"
|
||||
|
||||
if li_std_string.cvar.Structure_StaticMemberString2 != "static member string 2":
|
||||
if li_std_string_extra.cvar.Structure_StaticMemberString2 != "static member string 2":
|
||||
raise RuntimeError, "StaticMemberString2 test 1"
|
||||
li_std_string.cvar.Structure_StaticMemberString2 = s
|
||||
if li_std_string.cvar.Structure_StaticMemberString2 != s:
|
||||
li_std_string_extra.cvar.Structure_StaticMemberString2 = s
|
||||
if li_std_string_extra.cvar.Structure_StaticMemberString2 != s:
|
||||
raise RuntimeError, "StaticMemberString2 test 2"
|
||||
if li_std_string.cvar.Structure_ConstStaticMemberString != "const static member string":
|
||||
if li_std_string_extra.cvar.Structure_ConstStaticMemberString != "const static member string":
|
||||
raise RuntimeError, "ConstStaticMemberString test"
|
||||
|
||||
|
||||
if li_std_string.test_reference_input("hello") != "hello":
|
||||
if li_std_string_extra.test_reference_input("hello") != "hello":
|
||||
raise RuntimeError
|
||||
s = li_std_string.test_reference_inout("hello")
|
||||
s = li_std_string_extra.test_reference_inout("hello")
|
||||
if s != "hellohello":
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
if li_std_string.stdstring_empty() != "":
|
||||
if li_std_string_extra.stdstring_empty() != "":
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
if li_std_string.c_empty() != "":
|
||||
if li_std_string_extra.c_empty() != "":
|
||||
raise RuntimeError
|
||||
|
||||
if li_std_string.c_null() != None:
|
||||
if li_std_string_extra.c_null() != None:
|
||||
raise RuntimeError
|
||||
|
|
@ -10,8 +10,8 @@ srcdir = @srcdir@
|
|||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
C_TEST_CASES = copy_struct simple_array legacy
|
||||
CPP_TEST_CASES = double_delete
|
||||
C_TEST_CASES = r_copy_struct r_legacy
|
||||
CPP_TEST_CASES = r_double_delete
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
# This file illustrates the proxy class C++ interface generated
|
||||
# by SWIG.
|
||||
|
||||
dyn.load(paste("double_delete", .Platform$dynlib.ext, sep=""))
|
||||
source("double_delete.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
# ----- Object creation -----
|
||||
|
||||
f <- Foo(2.0)
|
||||
delete(f);
|
||||
delete(f);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
source("unittest.R")
|
||||
dyn.load(paste("copy_struct", .Platform$dynlib.ext, sep=""))
|
||||
source("copy_struct.R")
|
||||
dyn.load(paste("r_copy_struct", .Platform$dynlib.ext, sep=""))
|
||||
source("r_copy_struct.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
a <- getA()
|
||||
9
Examples/test-suite/r/r_double_delete_runme.R
Normal file
9
Examples/test-suite/r/r_double_delete_runme.R
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
dyn.load(paste("r_double_delete", .Platform$dynlib.ext, sep=""))
|
||||
source("r_double_delete.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
# ----- Object creation -----
|
||||
|
||||
f <- Foo(2.0)
|
||||
delete(f);
|
||||
delete(f);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
source("unittest.R")
|
||||
dyn.load(paste("legacy", .Platform$dynlib.ext, sep=""))
|
||||
source("legacy.R")
|
||||
dyn.load(paste("r_legacy", .Platform$dynlib.ext, sep=""))
|
||||
source("r_legacy.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
obj <- getObject(1,3)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module copy_struct
|
||||
%module r_copy_struct
|
||||
|
||||
%feature("opaque", "yes") B;
|
||||
%feature("opaque", "yes") C;
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
/* File : example.i */
|
||||
%module double_delete
|
||||
%module r_double_delete
|
||||
|
||||
%inline %{
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module legacy
|
||||
%module r_legacy
|
||||
%inline %{
|
||||
typedef char *String;
|
||||
|
||||
|
|
@ -10,7 +10,6 @@ top_srcdir = @top_srcdir@
|
|||
top_builddir = @top_builddir@
|
||||
|
||||
CPP_TEST_CASES = \
|
||||
keywords \
|
||||
li_cdata \
|
||||
li_cstring \
|
||||
li_factory \
|
||||
|
|
@ -20,11 +19,14 @@ CPP_TEST_CASES = \
|
|||
li_std_queue \
|
||||
li_std_set \
|
||||
li_std_stack \
|
||||
naming \
|
||||
primitive_types \
|
||||
std_containers \
|
||||
track_objects \
|
||||
track_objects_directors
|
||||
ruby_keywords \
|
||||
ruby_naming \
|
||||
ruby_track_objects \
|
||||
ruby_track_objects_directors \
|
||||
std_containers
|
||||
# ruby_li_std_speed
|
||||
# stl_new
|
||||
|
||||
C_TEST_CASES += \
|
||||
li_cdata \
|
||||
|
|
@ -39,7 +41,7 @@ SWIGOPT += -w801 -noautorename -features autodoc=4
|
|||
# Rules for the different types of tests
|
||||
|
||||
# make sure -autorename is true for the naming test
|
||||
naming.cpptest: SWIGOPT = -autorename
|
||||
ruby_naming.cpptest: SWIGOPT += -autorename
|
||||
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
require 'swig_assert'
|
||||
|
||||
require 'keywords'
|
||||
require 'ruby_keywords'
|
||||
|
||||
kw = Keywords::Keywords.new
|
||||
kw = Ruby_keywords::Keywords.new
|
||||
|
||||
if kw.alias != 'alias' then
|
||||
raise RuntimeError, 'Keyword method did not work: alias'
|
||||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
require 'benchmark'
|
||||
require 'mathn'
|
||||
require 'li_std_speed'
|
||||
include Li_std_speed
|
||||
require 'ruby_li_std_speed'
|
||||
include Ruby_li_std_speed
|
||||
|
||||
|
||||
def benchmark(f, phigh, sequences)
|
||||
|
|
@ -9,86 +9,86 @@
|
|||
|
||||
require 'swig_assert'
|
||||
|
||||
require 'naming'
|
||||
require 'ruby_naming'
|
||||
|
||||
# Check class names
|
||||
if not Naming
|
||||
raise RuntimeError, 'Invalid module name for Naming'
|
||||
if not Ruby_naming
|
||||
raise RuntimeError, 'Invalid module name for Ruby_naming'
|
||||
end
|
||||
|
||||
if not Naming::MyClass
|
||||
if not Ruby_naming::MyClass
|
||||
raise RuntimeError, 'Invalid class name for MyClass'
|
||||
end
|
||||
|
||||
|
||||
# Check constant names / values
|
||||
if Naming::CONSTANT1 != 1
|
||||
if Ruby_naming::CONSTANT1 != 1
|
||||
raise RuntimeError, "Incorrect value for CONSTANT1"
|
||||
end
|
||||
|
||||
if Naming::CONSTANT2 != 2
|
||||
if Ruby_naming::CONSTANT2 != 2
|
||||
raise RuntimeError, "Incorrect value for CONSTANT2"
|
||||
end
|
||||
|
||||
# Check constant names / values
|
||||
if Naming::CONSTANT3 != 3
|
||||
if Ruby_naming::CONSTANT3 != 3
|
||||
raise RuntimeError, "Incorrect value for CONSTANT3"
|
||||
end
|
||||
|
||||
if not Naming::methods.include?("constant4")
|
||||
if not Ruby_naming::methods.include?("constant4")
|
||||
raise RuntimeError, "Incorrect mapping for constant4"
|
||||
end
|
||||
|
||||
if not Naming::methods.include?("constant5")
|
||||
if not Ruby_naming::methods.include?("constant5")
|
||||
raise RuntimeError, "Incorrect mapping for constant5"
|
||||
end
|
||||
|
||||
if not Naming::methods.include?("constant6")
|
||||
if not Ruby_naming::methods.include?("constant6")
|
||||
raise RuntimeError, "Incorrect mapping for constant6"
|
||||
end
|
||||
|
||||
if not Naming::TestConstants.instance_methods.include?("constant7")
|
||||
if not Ruby_naming::TestConstants.instance_methods.include?("constant7")
|
||||
raise RuntimeError, "Incorrect mapping for constant7"
|
||||
end
|
||||
|
||||
if not Naming::TestConstants.methods.include?("constant8")
|
||||
if not Ruby_naming::TestConstants.methods.include?("constant8")
|
||||
raise RuntimeError, "Incorrect mapping for constant8"
|
||||
end
|
||||
|
||||
# There is no constant9 because it is illegal C++
|
||||
#if not Naming::TestConstants.instance_methods.include?("constant9")
|
||||
#if not Ruby_naming::TestConstants.instance_methods.include?("constant9")
|
||||
# raise RuntimeError, "Incorrect mapping for constant9"
|
||||
#end
|
||||
|
||||
if Naming::TestConstants::CONSTANT10 != 10
|
||||
if Ruby_naming::TestConstants::CONSTANT10 != 10
|
||||
raise RuntimeError, "Incorrect value for CONSTANT10"
|
||||
end
|
||||
|
||||
if not Naming::methods.include?("constant11")
|
||||
if not Ruby_naming::methods.include?("constant11")
|
||||
raise RuntimeError, "Incorrect mapping for constant11"
|
||||
end
|
||||
|
||||
|
||||
# Check enums
|
||||
if Naming::constants.include?("Color")
|
||||
if Ruby_naming::constants.include?("Color")
|
||||
raise RuntimeError, "Color enum should not be exposed to Ruby"
|
||||
end
|
||||
|
||||
if Naming::Red != 0
|
||||
if Ruby_naming::Red != 0
|
||||
raise RuntimeError, "Incorrect value for enum RED"
|
||||
end
|
||||
|
||||
if Naming::Green != 1
|
||||
if Ruby_naming::Green != 1
|
||||
raise RuntimeError, "Incorrect value for enum GREEN"
|
||||
end
|
||||
|
||||
if Naming::Blue != 2
|
||||
if Ruby_naming::Blue != 2
|
||||
raise RuntimeError, "Incorrect value for enum BLUE"
|
||||
end
|
||||
|
||||
|
||||
# Check method names
|
||||
my_class = Naming::MyClass.new()
|
||||
my_class = Ruby_naming::MyClass.new()
|
||||
|
||||
if my_class.method_one != 1
|
||||
raise RuntimeError, "Incorrect value for method_one"
|
||||
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
require 'swig_assert'
|
||||
|
||||
require 'track_objects_directors'
|
||||
require 'ruby_track_objects_directors'
|
||||
|
||||
class MyFoo < Track_objects_directors::Foo
|
||||
class MyFoo < Ruby_track_objects_directors::Foo
|
||||
def ping
|
||||
"MyFoo::ping()"
|
||||
end
|
||||
|
|
@ -22,12 +22,12 @@ a = MyFoo.new
|
|||
raise RuntimeError if a.ping != "MyFoo::ping()"
|
||||
raise RuntimeError if a.pong != "Foo::pong();MyFoo::ping()"
|
||||
|
||||
b = Track_objects_directors::Foo.new
|
||||
b = Ruby_track_objects_directors::Foo.new
|
||||
|
||||
raise RuntimeError if b.ping != "Foo::ping()"
|
||||
raise RuntimeError if b.pong != "Foo::pong();Foo::ping()"
|
||||
|
||||
container = Track_objects_directors::Container.new
|
||||
container = Ruby_track_objects_directors::Container.new
|
||||
foo = MyFoo.new
|
||||
container.set_foo(foo)
|
||||
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
require 'swig_assert'
|
||||
|
||||
require 'track_objects'
|
||||
require 'ruby_track_objects'
|
||||
|
||||
def test_same_ruby_object(foo1, foo2)
|
||||
if not foo1.equal?(foo2)
|
||||
|
|
@ -23,12 +23,12 @@ def test_same_cpp_object(foo1, foo2)
|
|||
end
|
||||
end
|
||||
|
||||
bar = Track_objects::Bar.new
|
||||
foo1 = Track_objects::Foo.new()
|
||||
bar = Ruby_track_objects::Bar.new
|
||||
foo1 = Ruby_track_objects::Foo.new()
|
||||
bar.set_unowned_foo(foo1)
|
||||
|
||||
# test_simple_identity
|
||||
foo2 = Track_objects::Foo.new()
|
||||
foo2 = Ruby_track_objects::Foo.new()
|
||||
foo3 = foo2
|
||||
|
||||
test_same_ruby_object(foo2, foo3)
|
||||
|
|
@ -48,8 +48,8 @@ test_same_ruby_object(foo5, foo6)
|
|||
test_same_cpp_object(foo5, foo6)
|
||||
|
||||
# test_new_foo_identity
|
||||
foo7 = Track_objects::Bar.get_new_foo()
|
||||
foo8 = Track_objects::Bar.get_new_foo()
|
||||
foo7 = Ruby_track_objects::Bar.get_new_foo()
|
||||
foo8 = Ruby_track_objects::Bar.get_new_foo()
|
||||
|
||||
if foo7.equal?(foo8)
|
||||
raise "Ruby objects should be different."
|
||||
|
|
@ -60,7 +60,7 @@ if foo7.cpp_equal(foo8)
|
|||
end
|
||||
|
||||
# test_set_owned_identity
|
||||
foo9 = Track_objects::Foo.new
|
||||
foo9 = Ruby_track_objects::Foo.new
|
||||
bar.set_owned_foo(foo9)
|
||||
foo10 = bar.get_owned_foo()
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ test_same_cpp_object(foo9, foo10)
|
|||
|
||||
# test_set_owned_identity2
|
||||
begin
|
||||
foo11 = Track_objects::Foo.new
|
||||
foo11 = Ruby_track_objects::Foo.new
|
||||
bar.set_owned_foo(foo11)
|
||||
foo11 = nil
|
||||
end
|
||||
|
|
@ -90,20 +90,20 @@ test_same_ruby_object(foo13, foo14)
|
|||
test_same_cpp_object(foo13, foo14)
|
||||
|
||||
# Now create the factory
|
||||
factory = Track_objects::Factory.new
|
||||
factory = Ruby_track_objects::Factory.new
|
||||
|
||||
# Create itemA which is really an itemB
|
||||
itemA = factory.createItem
|
||||
|
||||
# Check class
|
||||
if itemA.class != Track_objects::ItemA
|
||||
if itemA.class != Ruby_track_objects::ItemA
|
||||
raise RuntimeError, 'Item should have an ItemA class'
|
||||
end
|
||||
|
||||
# Now downcast
|
||||
itemB = Track_objects.downcast(itemA)
|
||||
itemB = Ruby_track_objects.downcast(itemA)
|
||||
|
||||
if itemB.class != Track_objects::ItemB
|
||||
if itemB.class != Ruby_track_objects::ItemB
|
||||
raise RuntimeError, 'Item should have an ItemB class'
|
||||
end
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module keywords
|
||||
%module ruby_keywords
|
||||
|
||||
// fix up conflicts with C++ keywords
|
||||
%rename("and") Keywords::and_;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* @file li_std_speed.i
|
||||
* @file ruby_li_std_speed.i
|
||||
* @author gga
|
||||
* @date Fri May 18 18:03:15 2007
|
||||
*
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
%module li_std_speed
|
||||
%module ruby_li_std_speed
|
||||
|
||||
%include <std_list.i>
|
||||
%include <std_vector.i>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module naming
|
||||
%module ruby_naming
|
||||
|
||||
%predicate predicateMethod();
|
||||
%bang bangMethod();
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module track_objects
|
||||
%module ruby_track_objects
|
||||
|
||||
%include typemaps.i
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module(directors="1") track_objects_directors
|
||||
%module(directors="1") ruby_track_objects_directors
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
|
|
@ -11,15 +11,12 @@ top_builddir = @top_builddir@
|
|||
|
||||
CPP_TEST_CASES += \
|
||||
primitive_types \
|
||||
li_cdata \
|
||||
li_cstring \
|
||||
li_cwstring
|
||||
|
||||
C_TEST_CASES += \
|
||||
li_cdata \
|
||||
li_cstring \
|
||||
li_cwstring \
|
||||
union
|
||||
li_cwstring
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
|
|
|
|||
0
Examples/test-suite/tcl/union_runme.tcl
Executable file → Normal file
0
Examples/test-suite/tcl/union_runme.tcl
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue