merge revisions 11243-11872 from trunk to gsoc2009-matevz
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12162 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
ab1cd03979
387 changed files with 12383 additions and 4412 deletions
|
|
@ -89,8 +89,12 @@ SKIP_CPP_STD_CASES = Yes
|
|||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Overridden variables here
|
||||
# SWIGOPT += -debug-module 4
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
@ -110,9 +114,9 @@ include $(srcdir)/../common.mk
|
|||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.lisp appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
||||
%.clean:
|
||||
@rm -f $*.cl
|
||||
|
|
|
|||
33
Examples/test-suite/catches.i
Normal file
33
Examples/test-suite/catches.i
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
%module catches
|
||||
|
||||
%{
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
%}
|
||||
|
||||
%include <exception.i> // for throws(...) typemap
|
||||
|
||||
%catches(int, const char *, const ThreeException&) test_catches(int i);
|
||||
%catches(int, ...) test_exception_specification(int i); // override the exception specification
|
||||
%catches(...) test_catches_all(int i);
|
||||
|
||||
%inline %{
|
||||
struct ThreeException {};
|
||||
void test_catches(int i) {
|
||||
if (i == 1) {
|
||||
throw int(1);
|
||||
} else if (i == 2) {
|
||||
throw (const char *)"two";
|
||||
} else if (i == 3) {
|
||||
throw ThreeException();
|
||||
}
|
||||
}
|
||||
void test_exception_specification(int i) throw(int, const char *, const ThreeException&) {
|
||||
test_catches(i);
|
||||
}
|
||||
void test_catches_all(int i) {
|
||||
test_catches(i);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -11,10 +11,14 @@ top_builddir = @top_builddir@
|
|||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Overridden variables here
|
||||
# no C++ tests for now
|
||||
CPP_TEST_CASES =
|
||||
#C_TEST_CASES +=
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
@ -34,9 +38,9 @@ CPP_TEST_CASES =
|
|||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.lisp appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFIBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFIBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
||||
# Clean: (does nothing, we dont generate extra cffi code)
|
||||
%.clean:
|
||||
|
|
|
|||
|
|
@ -149,6 +149,18 @@ const char global_const_char_array2[sizeof(CPLUSPLUS_MSG)+1] = CPLUSPLUS_MSG;
|
|||
%inline %{
|
||||
|
||||
// char *& tests
|
||||
char *&GetCharPointerRef() {
|
||||
static char str[] = CPLUSPLUS_MSG;
|
||||
static char *ptr = str;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
bool SetCharPointerRef(char *&str, unsigned int number) {
|
||||
static char static_str[] = CPLUSPLUS_MSG;
|
||||
strcpy(static_str, str);
|
||||
return check(static_str, number);
|
||||
}
|
||||
|
||||
const char *&GetConstCharPointerRef() {
|
||||
static const char str[] = CPLUSPLUS_MSG;
|
||||
static const char *ptr = str;
|
||||
|
|
|
|||
|
|
@ -23,70 +23,73 @@ EXTRA_TEST_CASES += chicken_ext_test.externaltest
|
|||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
|
||||
# Overridden variables here
|
||||
SWIGOPT += -nounit
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# If there exists a PROXYSUFFIX runme file, we also generate the wrapper
|
||||
# with the -proxy argument
|
||||
%.cppproxy: SWIGOPT += -proxy
|
||||
%.cppproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
|
||||
|
||||
%.cproxy: SWIGOPT += -proxy
|
||||
%.cproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
|
||||
|
||||
%.multiproxy: SWIGOPT += -proxy -noclosuses
|
||||
%.multiproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
+$(swig_and_compile_cpp)
|
||||
$(run_testcase)
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \
|
||||
$(MAKE) $*.cppproxy; ) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
|
||||
$(MAKE) $*.cppproxy; \
|
||||
fi
|
||||
|
||||
%.ctest:
|
||||
$(setup)
|
||||
+$(swig_and_compile_c)
|
||||
$(run_testcase)
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \
|
||||
$(MAKE) $*.cproxy; ) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
|
||||
$(MAKE) $*.cproxy; \
|
||||
fi
|
||||
|
||||
%.multicpptest:
|
||||
$(setup)
|
||||
+$(swig_and_compile_multi_cpp)
|
||||
$(run_testcase)
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \
|
||||
$(MAKE) $*.multiproxy; ) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
|
||||
$(MAKE) $*.multiproxy; \
|
||||
fi
|
||||
|
||||
%.externaltest:
|
||||
$(setup)
|
||||
+$(swig_and_compile_external)
|
||||
$(run_testcase)
|
||||
|
||||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.scm appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
|
||||
fi;
|
||||
|
||||
# If there exists a PROXYSUFFIX runme file, we also generate the wrapper
|
||||
# with the -proxy argument
|
||||
%.cppproxy: SWIGOPT += -proxy
|
||||
%.cppproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
|
||||
%.cppproxy:
|
||||
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
|
||||
+$(swig_and_compile_cpp)
|
||||
$(run_testcase)
|
||||
|
||||
%.cproxy: SWIGOPT += -proxy
|
||||
%.cproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
|
||||
%.cproxy:
|
||||
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
|
||||
+$(swig_and_compile_c)
|
||||
$(run_testcase)
|
||||
|
||||
%.multiproxy: SWIGOPT += -proxy -noclosuses
|
||||
%.multiproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
|
||||
%.multiproxy:
|
||||
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
|
||||
+$(swig_and_compile_multi_cpp)
|
||||
$(run_testcase)
|
||||
|
||||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.scm appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
||||
# Clean
|
||||
%.clean:
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,14 @@ top_builddir = @top_builddir@
|
|||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Overridden variables here
|
||||
# no C++ tests for now
|
||||
CPP_TEST_CASES =
|
||||
#C_TEST_CASES +=
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
@ -34,9 +38,9 @@ CPP_TEST_CASES =
|
|||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.lisp appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISPBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISPBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
||||
# Clean: (does nothing, we dont generate extra clisp code)
|
||||
%.clean:
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
# b) Define rules for %.ctest, %.cpptest, %.multicpptest and %.clean.
|
||||
# c) Define srcdir, top_srcdir and top_builddir (these are the
|
||||
# equivalent to configure's variables of the same name).
|
||||
# 3) One off special commandline options can be achieved by adding a
|
||||
# test case to CUSTOM_TEST_CASES and defining rules to run and test.
|
||||
# 3) One off special commandline options for a testcase can be added.
|
||||
# See custom tests below.
|
||||
#
|
||||
# The 'check' target runs the testcases including SWIG invocation,
|
||||
# C/C++ compilation, target language compilation (if any) and runtime
|
||||
|
|
@ -28,12 +28,14 @@
|
|||
# The 'clean' target cleans up.
|
||||
#
|
||||
# Note that the RUNTOOL, COMPILETOOL and SWIGTOOL variables can be used
|
||||
# for # invoking tools for the runtime tests and target language
|
||||
# for invoking tools for the runtime tests and target language
|
||||
# compiler (eg javac) respectively. For example, valgrind can be used
|
||||
# for memory checking of the runtime tests using:
|
||||
# make RUNTOOL="valgrind --leak-check-full"
|
||||
# make RUNTOOL="valgrind --leak-check=full"
|
||||
# and valgrind can be used when invoking SWIG using:
|
||||
# make SWIGTOOL="valgrind --tool=memcheck"
|
||||
# make SWIGTOOL="valgrind --tool=memcheck --trace-children=yes"
|
||||
# Note: trace-children needed because of preinst-swig shell wrapper
|
||||
# to the swig executable.
|
||||
#
|
||||
# The variables below can be overridden after including this makefile
|
||||
#######################################################################
|
||||
|
|
@ -71,27 +73,25 @@ INTERFACEDIR = ../
|
|||
# Note that any whitespace after the last entry in each list will break make
|
||||
#
|
||||
|
||||
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
|
||||
# Broken C++ test cases. (Can be run individually using: make testcase.cpptest)
|
||||
CPP_TEST_BROKEN += \
|
||||
constants \
|
||||
cpp_broken \
|
||||
exception_partial_info \
|
||||
extend_variable \
|
||||
li_std_vector_ptr \
|
||||
namespace_union \
|
||||
nested_struct \
|
||||
overload_complicated \
|
||||
template_default_pointer \
|
||||
template_expr \
|
||||
$(CPP0X_TEST_BROKEN)
|
||||
|
||||
|
||||
# Broken C test cases. (Can be run individually using make testcase.ctest.)
|
||||
# Broken C test cases. (Can be run individually using: make testcase.ctest)
|
||||
C_TEST_BROKEN += \
|
||||
tag_no_clash_with_variable
|
||||
|
||||
|
||||
# C++ test cases. (Can be run individually using make testcase.cpptest.)
|
||||
# C++ test cases. (Can be run individually using: make testcase.cpptest)
|
||||
CPP_TEST_CASES += \
|
||||
$(CPP0X_TEST_CASES) \
|
||||
abstract_access \
|
||||
|
|
@ -119,6 +119,7 @@ CPP_TEST_CASES += \
|
|||
arrays_scope \
|
||||
bloody_hell \
|
||||
bools \
|
||||
catches \
|
||||
cast_operator \
|
||||
casts \
|
||||
char_strings \
|
||||
|
|
@ -190,6 +191,7 @@ CPP_TEST_CASES += \
|
|||
extend_placement \
|
||||
extend_template \
|
||||
extend_template_ns \
|
||||
extern_c \
|
||||
extern_namespace \
|
||||
extern_throws \
|
||||
features \
|
||||
|
|
@ -198,6 +200,7 @@ CPP_TEST_CASES += \
|
|||
fvirtual \
|
||||
global_namespace \
|
||||
global_ns_arg \
|
||||
global_scope_types \
|
||||
global_vars \
|
||||
grouping \
|
||||
ignore_parameter \
|
||||
|
|
@ -222,6 +225,7 @@ CPP_TEST_CASES += \
|
|||
li_typemaps \
|
||||
li_windows \
|
||||
long_long_apply \
|
||||
memberin_extend \
|
||||
member_pointer \
|
||||
member_template \
|
||||
minherit \
|
||||
|
|
@ -238,9 +242,12 @@ CPP_TEST_CASES += \
|
|||
namespace_template \
|
||||
namespace_typedef_class \
|
||||
namespace_typemap \
|
||||
namespace_union \
|
||||
namespace_virtual_method \
|
||||
naturalvar \
|
||||
nested_class \
|
||||
nested_comment \
|
||||
nested_workaround \
|
||||
newobject1 \
|
||||
null_pointer \
|
||||
operator_overload \
|
||||
|
|
@ -255,6 +262,7 @@ CPP_TEST_CASES += \
|
|||
overload_template \
|
||||
overload_template_fast \
|
||||
pointer_reference \
|
||||
preproc_constants \
|
||||
primitive_ref \
|
||||
private_assign \
|
||||
protected_rename \
|
||||
|
|
@ -293,10 +301,13 @@ CPP_TEST_CASES += \
|
|||
smart_pointer_templatevariables \
|
||||
smart_pointer_typedef \
|
||||
special_variables \
|
||||
special_variable_macros \
|
||||
static_array_member \
|
||||
static_const_member \
|
||||
static_const_member_2 \
|
||||
struct_initialization_cpp \
|
||||
struct_value \
|
||||
symbol_clash \
|
||||
template \
|
||||
template_arg_replace \
|
||||
template_arg_scope \
|
||||
|
|
@ -326,6 +337,8 @@ CPP_TEST_CASES += \
|
|||
template_inherit_abstract \
|
||||
template_int_const \
|
||||
template_methods \
|
||||
template_nested \
|
||||
template_nested_typemaps \
|
||||
template_ns \
|
||||
template_ns2 \
|
||||
template_ns3 \
|
||||
|
|
@ -335,6 +348,8 @@ CPP_TEST_CASES += \
|
|||
template_ns_inherit \
|
||||
template_ns_scope \
|
||||
template_partial_arg \
|
||||
template_partial_specialization \
|
||||
template_partial_specialization_typedef \
|
||||
template_qualifier \
|
||||
template_qualifier \
|
||||
template_ref_type \
|
||||
|
|
@ -370,9 +385,11 @@ CPP_TEST_CASES += \
|
|||
typedef_scope \
|
||||
typedef_sizet \
|
||||
typedef_struct \
|
||||
typemap_global_scope \
|
||||
typemap_namespace \
|
||||
typemap_ns_using \
|
||||
typemap_numinputs \
|
||||
typemap_template \
|
||||
typemap_out_optimal \
|
||||
typemap_variables \
|
||||
typemap_various \
|
||||
|
|
@ -396,6 +413,7 @@ CPP_TEST_CASES += \
|
|||
virtual_destructor \
|
||||
virtual_poly \
|
||||
voidtest \
|
||||
wallkw \
|
||||
wrapmacro
|
||||
|
||||
# C++0x test cases.
|
||||
|
|
@ -437,8 +455,10 @@ CPP0X_TEST_BROKEN =
|
|||
CPP_STD_TEST_CASES += \
|
||||
director_string \
|
||||
ignore_template_constructor \
|
||||
li_std_combinations \
|
||||
li_std_deque \
|
||||
li_std_except \
|
||||
li_std_map \
|
||||
li_std_pair \
|
||||
li_std_string \
|
||||
li_std_vector \
|
||||
|
|
@ -455,11 +475,12 @@ CPP_TEST_CASES += ${CPP_STD_TEST_CASES}
|
|||
endif
|
||||
|
||||
|
||||
# C test cases. (Can be run individually using make testcase.ctest.)
|
||||
# C test cases. (Can be run individually using: make testcase.ctest)
|
||||
C_TEST_CASES += \
|
||||
arrays \
|
||||
char_constant \
|
||||
const_const \
|
||||
constant_expr \
|
||||
empty \
|
||||
enums \
|
||||
extern_declaration \
|
||||
|
|
@ -477,24 +498,28 @@ C_TEST_CASES += \
|
|||
li_cpointer \
|
||||
li_math \
|
||||
long_long \
|
||||
memberin_extend_c \
|
||||
name \
|
||||
nested \
|
||||
nested_structs \
|
||||
newobject2 \
|
||||
overload_extend \
|
||||
overload_extendc \
|
||||
preproc \
|
||||
preproc_constants_c \
|
||||
ret_by_value \
|
||||
simple_array \
|
||||
sizeof_pointer \
|
||||
sneaky1 \
|
||||
struct_rename \
|
||||
struct_initialization \
|
||||
typedef_struct \
|
||||
typemap_subst \
|
||||
union_parameter \
|
||||
unions
|
||||
|
||||
|
||||
# Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest.)
|
||||
# Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest)
|
||||
MULTI_CPP_TEST_CASES += \
|
||||
clientdata_prop \
|
||||
imports \
|
||||
|
|
@ -503,10 +528,13 @@ MULTI_CPP_TEST_CASES += \
|
|||
template_typedef_import \
|
||||
multi_import
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
wallkw.cpptest: SWIGOPT += -Wallkw
|
||||
|
||||
|
||||
NOT_BROKEN_TEST_CASES = $(CPP_TEST_CASES:=.cpptest) \
|
||||
$(C_TEST_CASES:=.ctest) \
|
||||
$(MULTI_CPP_TEST_CASES:=.multicpptest) \
|
||||
$(CUSTOM_TEST_CASES:=.customtest) \
|
||||
$(EXTRA_TEST_CASES)
|
||||
|
||||
BROKEN_TEST_CASES = $(CPP_TEST_BROKEN:=.cpptest) \
|
||||
|
|
@ -515,7 +543,6 @@ BROKEN_TEST_CASES = $(CPP_TEST_BROKEN:=.cpptest) \
|
|||
ALL_CLEAN = $(CPP_TEST_CASES:=.clean) \
|
||||
$(C_TEST_CASES:=.clean) \
|
||||
$(MULTI_CPP_TEST_CASES:=.clean) \
|
||||
$(CUSTOM_TEST_CASES:=.clean) \
|
||||
$(CPP_TEST_BROKEN:=.clean) \
|
||||
$(C_TEST_BROKEN:=.clean)
|
||||
|
||||
|
|
|
|||
11
Examples/test-suite/constant_expr.i
Normal file
11
Examples/test-suite/constant_expr.i
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
%module constant_expr;
|
||||
/* Tests of constant expressions. */
|
||||
|
||||
%inline %{
|
||||
|
||||
/* % didn't work in SWIG 1.3.40 and earlier. */
|
||||
const int X = 123%7;
|
||||
#define FOO 12 % 6
|
||||
double d_array[12 % 6];
|
||||
|
||||
%}
|
||||
|
|
@ -121,7 +121,8 @@ int* const globalRet2() {return &GlobalInt;}
|
|||
|
||||
%{
|
||||
static int wxEVT_COMMAND_BUTTON_CLICKEDv;
|
||||
static int **wxEVT_COMMAND_BUTTON_CLICKEDp;
|
||||
static int *wxEVT_COMMAND_BUTTON_CLICKEDp;
|
||||
static int **wxEVT_COMMAND_BUTTON_CLICKEDpp = &wxEVT_COMMAND_BUTTON_CLICKEDp;
|
||||
#if defined(SWIGR)
|
||||
#undef lang1 /* conflicts with symbol in R internals */
|
||||
#endif
|
||||
|
|
@ -137,7 +138,7 @@ char *langs[] ={ lang1 };
|
|||
#define EWXWEXPORT_VAR
|
||||
|
||||
const int* wxEVENT_COMMAND_BUTTON_CLICKEDr = (int*) &wxEVT_COMMAND_BUTTON_CLICKEDv;
|
||||
const int* wxEVENT_COMMAND_BUTTON_CLICKEDp = (int*) *wxEVT_COMMAND_BUTTON_CLICKEDp;
|
||||
const int* wxEVENT_COMMAND_BUTTON_CLICKEDp = (int*) *wxEVT_COMMAND_BUTTON_CLICKEDpp;
|
||||
char **languages1 = &langs[0];
|
||||
char **languages2 = (char **)&langs[0];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,10 +73,6 @@ public:
|
|||
|
||||
%include "std_vector.i"
|
||||
|
||||
#if defined(SWIGCSHARP)
|
||||
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(Flow, Space::Flow)
|
||||
#endif
|
||||
|
||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
|
||||
#define SWIG_GOOD_VECTOR
|
||||
%ignore std::vector<Space::Flow>::vector(size_type);
|
||||
|
|
|
|||
|
|
@ -1,36 +1,6 @@
|
|||
%module cpp_broken
|
||||
|
||||
|
||||
// bug #1060789
|
||||
%inline %{
|
||||
#define MASK(shift, size) (((1 << (size)) - 1) << (shift))
|
||||
#define SOME_MASK_DEF (80*MASK(8, 10))
|
||||
%}
|
||||
|
||||
// bug #1060079
|
||||
%inline %{
|
||||
#define FIELD(name, width) unsigned int name:width
|
||||
#define SOME_CONST 2
|
||||
#define NEXT_CONST (2 * SOME_CONST)
|
||||
|
||||
typedef struct {
|
||||
FIELD(a, SOME_CONST);
|
||||
FIELD(b, NEXT_CONST);
|
||||
} MyStruct_t;
|
||||
%}
|
||||
|
||||
%{
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
%}
|
||||
|
||||
// bug #994301
|
||||
%inline %{
|
||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
||||
%}
|
||||
|
||||
|
||||
// bug #940318
|
||||
%inline %{
|
||||
typedef enum {
|
||||
|
|
@ -40,36 +10,3 @@ eZero = 0
|
|||
%}
|
||||
|
||||
|
||||
// bug #754443
|
||||
|
||||
%inline %{
|
||||
#define MAG_STYLE_BORDER_OFFS 0
|
||||
#define MAG_STYLE_BORDER_BITS 3
|
||||
#define MAG_STYLE_BORDER_MASK (((1UL<<MAG_STYLE_BORDER_BITS)-1)<<MAG_STYLE_BORDER_OFFS)
|
||||
|
||||
/* these CANNOT be combined */
|
||||
#define MAG_STYLE_BORDER_NONE (1 << MAG_STYLE_BORDER_OFFS)
|
||||
#define MAG_STYLE_BORDER_STATIC (2 << MAG_STYLE_BORDER_OFFS)
|
||||
#define MAG_STYLE_BORDER_SIMPLE (3 << MAG_STYLE_BORDER_OFFS)
|
||||
#define MAG_STYLE_BORDER_RAISED (4 << MAG_STYLE_BORDER_OFFS)
|
||||
#define MAG_STYLE_BORDER_DOUBLE (5 << MAG_STYLE_BORDER_OFFS)
|
||||
#define MAG_STYLE_BORDER_DEFAULT MAG_STYLE_BORDER_SIMPLE
|
||||
|
||||
|
||||
#define MAG_STYLE_CAPTION_OFFS ( MAG_STYLE_BORDER_OFFS + MAG_STYLE_BORDER_BITS )
|
||||
#define MAG_STYLE_CAPTION_BITS 8
|
||||
#define MAG_STYLE_CAPTION_MASK (((1UL<<MAG_STYLE_CAPTION_BITS)-1)<<MAG_STYLE_CAPTION_OFFS)
|
||||
|
||||
/* these CAN be combined */
|
||||
#define MAG_STYLE_CAPTION_NONE ( 1 << ( 0 + MAG_STYLE_CAPTION_OFFS ))
|
||||
#define MAG_STYLE_CAPTION_PRESENT ( 1 << ( 1 + MAG_STYLE_CAPTION_OFFS ))
|
||||
#define MAG_STYLE_CAPTION_SYSMENU ( 1 << ( 2 + MAG_STYLE_CAPTION_OFFS ))
|
||||
#define MAG_STYLE_CAPTION_MINIMIZE ( 1 << ( 3 + MAG_STYLE_CAPTION_OFFS ))
|
||||
#define MAG_STYLE_CAPTION_MAXIMIZE ( 1 << ( 4 + MAG_STYLE_CAPTION_OFFS ))
|
||||
#define MAG_STYLE_CAPTION_RESIZE ( 1 << ( 5 + MAG_STYLE_CAPTION_OFFS ))
|
||||
#define MAG_STYLE_CAPTION_TINYHOR ( 1 << ( 6 + MAG_STYLE_CAPTION_OFFS ))
|
||||
#define MAG_STYLE_CAPTION_TINYVER ( 1 << ( 7 + MAG_STYLE_CAPTION_OFFS ))
|
||||
#define MAG_STYLE_CAPTION_DEFAULT ( MAG_STYLE_CAPTION_RESIZE + MAG_STYLE_CAPTION_MAXIMIZE + MAG_STYLE_CAPTION_MINIMIZE + MAG_STYLE_CAPTION_SYSMENU + MAG_STYLE_CAPTION_PRESENT )
|
||||
|
||||
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -15,24 +15,26 @@ CPP_TEST_CASES = \
|
|||
csharp_attributes \
|
||||
csharp_exceptions \
|
||||
csharp_features \
|
||||
csharp_lib_arrays \
|
||||
csharp_prepost \
|
||||
csharp_typemaps \
|
||||
enum_thorough_simple \
|
||||
enum_thorough_typesafe \
|
||||
exception_partial_info
|
||||
|
||||
CUSTOM_TEST_CASES = \
|
||||
csharp_lib_arrays \
|
||||
exception_partial_info \
|
||||
intermediary_classname
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Overridden variables here
|
||||
SWIGOPT += -namespace $*Namespace $(SWIGOPTSPECIAL)
|
||||
SWIGOPT += -namespace $*Namespace
|
||||
INTERFACEDIR = ../../
|
||||
|
||||
CSHARPFLAGSSPECIAL =
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
intermediary_classname.cpptest: SWIGOPT += -dllimport intermediary_classname
|
||||
csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
@ -49,12 +51,6 @@ CSHARPFLAGSSPECIAL =
|
|||
+(cd $* && $(swig_and_compile_multi_cpp))
|
||||
+$(run_testcase)
|
||||
|
||||
# Rules for custom tests
|
||||
intermediary_classname.customtest:
|
||||
$(MAKE) intermediary_classname.cpptest SWIGOPTSPECIAL="-dllimport intermediary_classname"
|
||||
csharp_lib_arrays.customtest:
|
||||
$(MAKE) csharp_lib_arrays.cpptest CSHARPFLAGSSPECIAL="-unsafe"
|
||||
|
||||
# Makes a directory for the testcase if it does not exist
|
||||
setup = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
|
|
@ -63,31 +59,31 @@ setup = \
|
|||
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
|
||||
fi; \
|
||||
if [ ! -d $* ]; then \
|
||||
mkdir $*; \
|
||||
fi;
|
||||
mkdir $*; \
|
||||
fi
|
||||
|
||||
# Compiles C# files then runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.cs appended after the testcase name.
|
||||
# Note C# uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows and SHLIB_PATH on HPUX.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
|
||||
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` \
|
||||
$*$(CSHARPPATHSEPARATOR)*.cs' csharp_compile && \
|
||||
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" $(RUNTOOL) $(INTERPRETER) $*_runme.exe; ) \
|
||||
else ( \
|
||||
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" $(RUNTOOL) $(INTERPRETER) $*_runme.exe; \
|
||||
else \
|
||||
cd $* && \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
|
||||
CSHARPSRCS='*.cs' csharp_compile; ); \
|
||||
fi;
|
||||
CSHARPSRCS='*.cs' csharp_compile && cd .. ; \
|
||||
fi
|
||||
|
||||
# Clean: remove testcase directories
|
||||
%.clean:
|
||||
@if [ -d $* ]; then \
|
||||
rm -rf $*; \
|
||||
fi;
|
||||
rm -rf $*; \
|
||||
fi
|
||||
|
||||
clean:
|
||||
@rm -f *.exe *.exe.mdb
|
||||
|
|
|
|||
66
Examples/test-suite/csharp/catches_runme.cs
Normal file
66
Examples/test-suite/csharp/catches_runme.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
using System;
|
||||
using catchesNamespace;
|
||||
|
||||
public class runme {
|
||||
static void Main() {
|
||||
// test_catches()
|
||||
try {
|
||||
catches.test_catches(1);
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "C++ int exception thrown, value: 1")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
try {
|
||||
catches.test_catches(2);
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "two")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
try {
|
||||
catches.test_catches(3);
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "C++ ThreeException const & exception thrown")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
// test_exception_specification()
|
||||
try {
|
||||
catches.test_exception_specification(1);
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "C++ int exception thrown, value: 1")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
try {
|
||||
catches.test_exception_specification(2);
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "unknown exception")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
try {
|
||||
catches.test_exception_specification(3);
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "unknown exception")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
// test_catches_all()
|
||||
try {
|
||||
catches.test_catches_all(1);
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "unknown exception")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -120,15 +120,26 @@ public class char_strings_runme {
|
|||
|
||||
// char *& tests
|
||||
for (i=0; i<count; i++) {
|
||||
String str = char_strings.GetConstCharPointerRef();
|
||||
String str = char_strings.GetCharPointerRef();
|
||||
if (str != CPLUSPLUS_MSG)
|
||||
throw new Exception("Test char pointer ref get failed, iteration " + i);
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i))
|
||||
if (!char_strings.SetCharPointerRef(OTHERLAND_MSG + i, i))
|
||||
throw new Exception("Test char pointer ref set failed, iteration " + i);
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
String str = char_strings.GetConstCharPointerRef();
|
||||
if (str != CPLUSPLUS_MSG)
|
||||
throw new Exception("Test const char pointer ref get failed, iteration " + i);
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i))
|
||||
throw new Exception("Test const char pointer ref set failed, iteration " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.ComponentModel;
|
||||
using csharp_attributesNamespace;
|
||||
|
||||
public class runme
|
||||
|
|
@ -171,6 +172,24 @@ public class runme
|
|||
if (Attribute.GetCustomAttribute(member, typeof(Eurostar2Attribute)) == null)
|
||||
throw new Exception("No attribute for " + member.Name);
|
||||
}
|
||||
// Enum value attributes
|
||||
Type walesType = typeof(MoreStations.Wales);
|
||||
{
|
||||
MemberInfo member = (MemberInfo)walesType.GetMember("Cardiff")[0];
|
||||
DescriptionAttribute attribute = (DescriptionAttribute)Attribute.GetCustomAttribute(member, typeof(System.ComponentModel.DescriptionAttribute));
|
||||
if (attribute == null)
|
||||
throw new Exception("No attribute for " + member.Name);
|
||||
if (attribute.Description != "Cardiff city station")
|
||||
throw new Exception("Incorrect attribute value for " + member.Name);
|
||||
}
|
||||
{
|
||||
MemberInfo member = (MemberInfo)walesType.GetMember("Swansea")[0];
|
||||
DescriptionAttribute attribute = (DescriptionAttribute)Attribute.GetCustomAttribute(member, typeof(System.ComponentModel.DescriptionAttribute));
|
||||
if (attribute == null)
|
||||
throw new Exception("No attribute for " + member.Name);
|
||||
if (attribute.Description != "Swansea city station")
|
||||
throw new Exception("Incorrect attribute value for " + member.Name);
|
||||
}
|
||||
// Enum csattribute typemap
|
||||
{
|
||||
Type cymrutype = typeof(Cymru);
|
||||
|
|
@ -179,6 +198,8 @@ public class runme
|
|||
if (tgv == null)
|
||||
throw new Exception("No attribute for Cymru");
|
||||
}
|
||||
|
||||
// No runtime test for directorinattributes and directoroutattributes
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -237,3 +258,9 @@ public class ThreadSafeAttribute : Attribute {
|
|||
public ThreadSafeAttribute() {}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
|
||||
public class DirectorIntegerOutAttribute : Attribute {}
|
||||
|
||||
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
|
||||
public class DirectorIntegerInAttribute : Attribute {}
|
||||
|
||||
|
|
|
|||
|
|
@ -358,12 +358,51 @@ public class runme {
|
|||
i.MemberInstance = Instances.memberinstance3;
|
||||
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
|
||||
}
|
||||
// ignore enum item tests start
|
||||
{
|
||||
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero) != 0) throw new Exception("ignoreATest 0 failed");
|
||||
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three) != 3) throw new Exception("ignoreATest 3 failed");
|
||||
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten) != 10) throw new Exception("ignoreATest 10 failed");
|
||||
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven) != 11) throw new Exception("ignoreATest 11 failed");
|
||||
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen) != 13) throw new Exception("ignoreATest 13 failed");
|
||||
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen) != 14) throw new Exception("ignoreATest 14 failed");
|
||||
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty) != 20) throw new Exception("ignoreATest 20 failed");
|
||||
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty) != 30) throw new Exception("ignoreATest 30 failed");
|
||||
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two) != 32) throw new Exception("ignoreATest 32 failed");
|
||||
if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three) != 33) throw new Exception("ignoreATest 33 failed");
|
||||
}
|
||||
{
|
||||
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven) != 11) throw new Exception("ignoreBTest 11 failed");
|
||||
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve) != 12) throw new Exception("ignoreBTest 12 failed");
|
||||
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one) != 31) throw new Exception("ignoreBTest 31 failed");
|
||||
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two) != 32) throw new Exception("ignoreBTest 32 failed");
|
||||
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one) != 41) throw new Exception("ignoreBTest 41 failed");
|
||||
if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two) != 42) throw new Exception("ignoreBTest 42 failed");
|
||||
}
|
||||
{
|
||||
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten) != 10) throw new Exception("ignoreCTest 10 failed");
|
||||
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve) != 12) throw new Exception("ignoreCTest 12 failed");
|
||||
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty) != 30) throw new Exception("ignoreCTest 30 failed");
|
||||
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two) != 32) throw new Exception("ignoreCTest 32 failed");
|
||||
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty) != 40) throw new Exception("ignoreCTest 40 failed");
|
||||
if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two) != 42) throw new Exception("ignoreCTest 42 failed");
|
||||
}
|
||||
{
|
||||
if ((int)enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one) != 21) throw new Exception("ignoreDTest 21 failed");
|
||||
if ((int)enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two) != 22) throw new Exception("ignoreDTest 22 failed");
|
||||
}
|
||||
{
|
||||
if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero) != 0) throw new Exception("ignoreETest 0 failed");
|
||||
if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one) != 21) throw new Exception("ignoreETest 21 failed");
|
||||
if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two) != 22) throw new Exception("ignoreETest 22 failed");
|
||||
}
|
||||
// ignore enum item tests end
|
||||
{
|
||||
if ((int)enum_thorough.repeatTest(repeat.one) != 1) throw new Exception("repeatTest 1 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.initial) != 1) throw new Exception("repeatTest 2 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.two) != 2) throw new Exception("repeatTest 3 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.three) != 3) throw new Exception("repeatTest 4 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.last) != 3) throw new Exception("repeatTest 5 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.llast) != 3) throw new Exception("repeatTest 5 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.end) != 3) throw new Exception("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,12 +358,51 @@ public class runme {
|
|||
i.MemberInstance = Instances.memberinstance3;
|
||||
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
|
||||
}
|
||||
// ignore enum item tests start
|
||||
{
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_zero) != 0) throw new Exception("ignoreATest 0 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_three) != 3) throw new Exception("ignoreATest 3 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_ten) != 10) throw new Exception("ignoreATest 10 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_eleven) != 11) throw new Exception("ignoreATest 11 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirteen) != 13) throw new Exception("ignoreATest 13 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_fourteen) != 14) throw new Exception("ignoreATest 14 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_twenty) != 20) throw new Exception("ignoreATest 20 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty) != 30) throw new Exception("ignoreATest 30 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_two) != 32) throw new Exception("ignoreATest 32 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_three) != 33) throw new Exception("ignoreATest 33 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_eleven) != 11) throw new Exception("ignoreBTest 11 failed");
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_twelve) != 12) throw new Exception("ignoreBTest 12 failed");
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_one) != 31) throw new Exception("ignoreBTest 31 failed");
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_two) != 32) throw new Exception("ignoreBTest 32 failed");
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_one) != 41) throw new Exception("ignoreBTest 41 failed");
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_two) != 42) throw new Exception("ignoreBTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_ten) != 10) throw new Exception("ignoreCTest 10 failed");
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_twelve) != 12) throw new Exception("ignoreCTest 12 failed");
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty) != 30) throw new Exception("ignoreCTest 30 failed");
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty_two) != 32) throw new Exception("ignoreCTest 32 failed");
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty) != 40) throw new Exception("ignoreCTest 40 failed");
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty_two) != 42) throw new Exception("ignoreCTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_one) != 21) throw new Exception("ignoreDTest 21 failed");
|
||||
if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_two) != 22) throw new Exception("ignoreDTest 22 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_zero) != 0) throw new Exception("ignoreETest 0 failed");
|
||||
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_one) != 21) throw new Exception("ignoreETest 21 failed");
|
||||
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_two) != 22) throw new Exception("ignoreETest 22 failed");
|
||||
}
|
||||
// ignore enum item tests end
|
||||
{
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.one) != 1) throw new Exception("repeatTest 1 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.initial) != 1) throw new Exception("repeatTest 2 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.two) != 2) throw new Exception("repeatTest 3 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.three) != 3) throw new Exception("repeatTest 4 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.last) != 3) throw new Exception("repeatTest 5 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.llast) != 3) throw new Exception("repeatTest 5 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.end) != 3) throw new Exception("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,12 +358,51 @@ public class runme {
|
|||
i.MemberInstance = Instances.memberinstance3;
|
||||
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
|
||||
}
|
||||
// ignore enum item tests start
|
||||
{
|
||||
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue != 0) throw new Exception("ignoreATest 0 failed");
|
||||
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue != 3) throw new Exception("ignoreATest 3 failed");
|
||||
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue != 10) throw new Exception("ignoreATest 10 failed");
|
||||
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue != 11) throw new Exception("ignoreATest 11 failed");
|
||||
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue != 13) throw new Exception("ignoreATest 13 failed");
|
||||
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue != 14) throw new Exception("ignoreATest 14 failed");
|
||||
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue != 20) throw new Exception("ignoreATest 20 failed");
|
||||
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue != 30) throw new Exception("ignoreATest 30 failed");
|
||||
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue != 32) throw new Exception("ignoreATest 32 failed");
|
||||
if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue != 33) throw new Exception("ignoreATest 33 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue != 11) throw new Exception("ignoreBTest 11 failed");
|
||||
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue != 12) throw new Exception("ignoreBTest 12 failed");
|
||||
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue != 31) throw new Exception("ignoreBTest 31 failed");
|
||||
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue != 32) throw new Exception("ignoreBTest 32 failed");
|
||||
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue != 41) throw new Exception("ignoreBTest 41 failed");
|
||||
if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue != 42) throw new Exception("ignoreBTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue != 10) throw new Exception("ignoreCTest 10 failed");
|
||||
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue != 12) throw new Exception("ignoreCTest 12 failed");
|
||||
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue != 30) throw new Exception("ignoreCTest 30 failed");
|
||||
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue != 32) throw new Exception("ignoreCTest 32 failed");
|
||||
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue != 40) throw new Exception("ignoreCTest 40 failed");
|
||||
if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue != 42) throw new Exception("ignoreCTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typesafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue != 21) throw new Exception("ignoreDTest 21 failed");
|
||||
if (enum_thorough_typesafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue != 22) throw new Exception("ignoreDTest 22 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue != 0) throw new Exception("ignoreETest 0 failed");
|
||||
if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue != 21) throw new Exception("ignoreETest 21 failed");
|
||||
if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue != 22) throw new Exception("ignoreETest 22 failed");
|
||||
}
|
||||
// ignore enum item tests end
|
||||
{
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.one).swigValue != 1) throw new Exception("repeatTest 1 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.initial).swigValue != 1) throw new Exception("repeatTest 2 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.two).swigValue != 2) throw new Exception("repeatTest 3 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.three).swigValue != 3) throw new Exception("repeatTest 4 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.last).swigValue != 3) throw new Exception("repeatTest 5 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.llast).swigValue != 3) throw new Exception("repeatTest 5 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.end).swigValue != 3) throw new Exception("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
48
Examples/test-suite/csharp/exception_order_runme.cs
Normal file
48
Examples/test-suite/csharp/exception_order_runme.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using exception_orderNamespace;
|
||||
|
||||
public class runme {
|
||||
static void Main() {
|
||||
A a = new A();
|
||||
|
||||
try {
|
||||
a.foo();
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "C++ E1 exception thrown")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
try {
|
||||
a.bar();
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "C++ E2 exception thrown")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
try {
|
||||
a.foobar();
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "postcatch unknown")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
try {
|
||||
a.barfoo(1);
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "C++ E1 exception thrown")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
|
||||
try {
|
||||
a.barfoo(2);
|
||||
throw new Exception("missed exception");
|
||||
} catch (ApplicationException e) {
|
||||
if (e.Message != "C++ E2 * exception thrown")
|
||||
throw new ApplicationException("bad exception order: " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ public class li_std_map_runme {
|
|||
if (keyStringified != " 1 2 3 4 5")
|
||||
throw new Exception("Wrapped method stringifyKeys test failed. Got " + keyStringified);
|
||||
|
||||
// Test a map with a new specialized type (Struct)
|
||||
// Test a map with a new complex type (Struct)
|
||||
{
|
||||
IntStructMap ismap = new IntStructMap();
|
||||
for (int i = 0; i < 10; i++)
|
||||
|
|
@ -173,12 +173,12 @@ public class li_std_map_runme {
|
|||
}
|
||||
|
||||
if (ismap.Count != 10)
|
||||
throw new Exception("Count test on specialized map failed");
|
||||
throw new Exception("Count test on complex type map failed");
|
||||
|
||||
foreach (KeyValuePair<int, Struct> p in ismap)
|
||||
{
|
||||
if ((p.Key * 10.1) != p.Value.num)
|
||||
throw new Exception("Iteration test on specialized map failed for index " + p.Key);
|
||||
throw new Exception("Iteration test on complex type map failed for index " + p.Key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -191,12 +191,12 @@ public class li_std_map_runme {
|
|||
}
|
||||
|
||||
if (ispmap.Count != 10)
|
||||
throw new Exception("Count test on specialized pointer map failed");
|
||||
throw new Exception("Count test on complex type pointer map failed");
|
||||
|
||||
foreach (KeyValuePair<int, Struct> p in ispmap)
|
||||
{
|
||||
if ((p.Key * 10.1) != p.Value.num)
|
||||
throw new Exception("Iteration test on specialized pointer map failed for index " + p.Key);
|
||||
throw new Exception("Iteration test on complex type pointer map failed for index " + p.Key);
|
||||
}
|
||||
}
|
||||
{
|
||||
|
|
@ -207,29 +207,29 @@ public class li_std_map_runme {
|
|||
}
|
||||
|
||||
if (iscpmap.Count != 10)
|
||||
throw new Exception("Count test on specialized const pointer map failed");
|
||||
throw new Exception("Count test on complex type const pointer map failed");
|
||||
|
||||
foreach (KeyValuePair<int, Struct> p in iscpmap)
|
||||
{
|
||||
if ((p.Key * 10.1) != p.Value.num)
|
||||
throw new Exception("Iteration test on specialized const pointer map failed for index " + p.Key);
|
||||
throw new Exception("Iteration test on complex type const pointer map failed for index " + p.Key);
|
||||
}
|
||||
}
|
||||
|
||||
// Test non-specialized map
|
||||
// Test complex type as key (Struct)
|
||||
{
|
||||
StructIntMap limap = new StructIntMap();
|
||||
Struct s7 = new Struct(7);
|
||||
Struct s8 = new Struct(8);
|
||||
limap.setitem(s7 , 8);
|
||||
if (limap.getitem(s7) != 8)
|
||||
throw new Exception("Assignment test on non-specialized map failed");
|
||||
limap[s7] = 8;
|
||||
if (limap[s7] != 8)
|
||||
throw new Exception("Assignment test on complex key map failed");
|
||||
|
||||
if (!limap.ContainsKey(s7))
|
||||
throw new Exception("Key test (1) on non-specialized map failed");
|
||||
throw new Exception("Key test (1) on complex key map failed");
|
||||
|
||||
if (limap.ContainsKey(s8))
|
||||
throw new Exception("Key test (2) on non-specialized map failed");
|
||||
throw new Exception("Key test (2) on complex key map failed");
|
||||
}
|
||||
|
||||
// All done
|
||||
|
|
|
|||
|
|
@ -158,7 +158,8 @@ public class li_std_vector_runme {
|
|||
} catch (ArgumentNullException) {
|
||||
}
|
||||
{
|
||||
myDoubleVector = new DoubleVector() { 123.4, 567.8, 901.2 };
|
||||
// Collection initializer test, requires C# 3.0
|
||||
// myDoubleVector = new DoubleVector() { 123.4, 567.8, 901.2 };
|
||||
}
|
||||
|
||||
// IndexOf() test
|
||||
|
|
@ -542,8 +543,8 @@ public class li_std_vector_runme {
|
|||
|
||||
// Dispose()
|
||||
{
|
||||
using (StructVector vs = new StructVector() { new Struct(0.0), new Struct(11.1) } )
|
||||
using (DoubleVector vd = new DoubleVector() { 0.0, 11.1 } ) {
|
||||
using (StructVector vs = new StructVector( new Struct[] { new Struct(0.0), new Struct(11.1) } ) )
|
||||
using (DoubleVector vd = new DoubleVector( new double[] { 0.0, 11.1 } ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ public class runme
|
|||
{
|
||||
int f = overload_template.foo();
|
||||
|
||||
f += overload_template.max(3,4);
|
||||
double b = overload_template.max(3.4,5.2);
|
||||
f += overload_template.maximum(3,4);
|
||||
double b = overload_template.maximum(3.4,5.2);
|
||||
b++; // warning suppression
|
||||
|
||||
// mix 1
|
||||
|
|
|
|||
70
Examples/test-suite/csharp/preproc_constants_c_runme.cs
Normal file
70
Examples/test-suite/csharp/preproc_constants_c_runme.cs
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using preproc_constants_cNamespace;
|
||||
|
||||
// Same as preproc_constants_c.i testcase, but bool types are int instead
|
||||
public class runme {
|
||||
static void Main() {
|
||||
assert( typeof(int) == preproc_constants_c.CONST_INT1.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.CONST_INT2.GetType() );
|
||||
assert( typeof(uint) == preproc_constants_c.CONST_UINT1.GetType() );
|
||||
assert( typeof(uint) == preproc_constants_c.CONST_UINT2.GetType() );
|
||||
assert( typeof(uint) == preproc_constants_c.CONST_UINT3.GetType() );
|
||||
assert( typeof(uint) == preproc_constants_c.CONST_UINT4.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.CONST_LONG1.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.CONST_LONG2.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.CONST_LONG3.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.CONST_LONG4.GetType() );
|
||||
assert( typeof(long) == preproc_constants_c.CONST_LLONG1.GetType() );
|
||||
assert( typeof(long) == preproc_constants_c.CONST_LLONG2.GetType() );
|
||||
assert( typeof(long) == preproc_constants_c.CONST_LLONG3.GetType() );
|
||||
assert( typeof(long) == preproc_constants_c.CONST_LLONG4.GetType() );
|
||||
assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG1.GetType() );
|
||||
assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG2.GetType() );
|
||||
assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG3.GetType() );
|
||||
assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG4.GetType() );
|
||||
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE1.GetType() );
|
||||
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE2.GetType() );
|
||||
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE3.GetType() );
|
||||
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE4.GetType() );
|
||||
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE5.GetType() );
|
||||
assert( typeof(double) == preproc_constants_c.CONST_DOUBLE6.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.CONST_BOOL1.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.CONST_BOOL2.GetType() );
|
||||
assert( typeof(char) == preproc_constants_c.CONST_CHAR.GetType() );
|
||||
assert( typeof(string) == preproc_constants_c.CONST_STRING1.GetType() );
|
||||
assert( typeof(string) == preproc_constants_c.CONST_STRING2.GetType() );
|
||||
|
||||
assert( typeof(int) == preproc_constants_c.INT_AND_BOOL.GetType() );
|
||||
// assert( typeof(int) == preproc_constants_c.INT_AND_CHAR.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.INT_AND_INT.GetType() );
|
||||
assert( typeof(uint) == preproc_constants_c.INT_AND_UINT.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.INT_AND_LONG.GetType() );
|
||||
assert( typeof(uint) == preproc_constants_c.INT_AND_ULONG.GetType() );
|
||||
assert( typeof(long) == preproc_constants_c.INT_AND_LLONG.GetType() );
|
||||
assert( typeof(ulong) == preproc_constants_c.INT_AND_ULLONG.GetType() );
|
||||
assert( typeof(int ) == preproc_constants_c.BOOL_AND_BOOL.GetType() );
|
||||
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_MULTIPLY.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_DIVIDE.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_PLUS.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_MINUS.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_LSHIFT.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_RSHIFT.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_LTE.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_GTE.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_INEQUALITY.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_EQUALITY.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_AND.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_XOR.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_OR.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_LAND.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_LOR.GetType() );
|
||||
assert( typeof(double) == preproc_constants_c.EXPR_CONDITIONAL.GetType() );
|
||||
|
||||
}
|
||||
static void assert(bool assertion) {
|
||||
if (!assertion)
|
||||
throw new ApplicationException("test failed");
|
||||
}
|
||||
}
|
||||
69
Examples/test-suite/csharp/preproc_constants_runme.cs
Normal file
69
Examples/test-suite/csharp/preproc_constants_runme.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using preproc_constantsNamespace;
|
||||
|
||||
public class runme {
|
||||
static void Main() {
|
||||
assert( typeof(int) == preproc_constants.CONST_INT1.GetType() );
|
||||
assert( typeof(int) == preproc_constants.CONST_INT2.GetType() );
|
||||
assert( typeof(uint) == preproc_constants.CONST_UINT1.GetType() );
|
||||
assert( typeof(uint) == preproc_constants.CONST_UINT2.GetType() );
|
||||
assert( typeof(uint) == preproc_constants.CONST_UINT3.GetType() );
|
||||
assert( typeof(uint) == preproc_constants.CONST_UINT4.GetType() );
|
||||
assert( typeof(int) == preproc_constants.CONST_LONG1.GetType() );
|
||||
assert( typeof(int) == preproc_constants.CONST_LONG2.GetType() );
|
||||
assert( typeof(int) == preproc_constants.CONST_LONG3.GetType() );
|
||||
assert( typeof(int) == preproc_constants.CONST_LONG4.GetType() );
|
||||
assert( typeof(long) == preproc_constants.CONST_LLONG1.GetType() );
|
||||
assert( typeof(long) == preproc_constants.CONST_LLONG2.GetType() );
|
||||
assert( typeof(long) == preproc_constants.CONST_LLONG3.GetType() );
|
||||
assert( typeof(long) == preproc_constants.CONST_LLONG4.GetType() );
|
||||
assert( typeof(ulong) == preproc_constants.CONST_ULLONG1.GetType() );
|
||||
assert( typeof(ulong) == preproc_constants.CONST_ULLONG2.GetType() );
|
||||
assert( typeof(ulong) == preproc_constants.CONST_ULLONG3.GetType() );
|
||||
assert( typeof(ulong) == preproc_constants.CONST_ULLONG4.GetType() );
|
||||
assert( typeof(double) == preproc_constants.CONST_DOUBLE1.GetType() );
|
||||
assert( typeof(double) == preproc_constants.CONST_DOUBLE2.GetType() );
|
||||
assert( typeof(double) == preproc_constants.CONST_DOUBLE3.GetType() );
|
||||
assert( typeof(double) == preproc_constants.CONST_DOUBLE4.GetType() );
|
||||
assert( typeof(double) == preproc_constants.CONST_DOUBLE5.GetType() );
|
||||
assert( typeof(double) == preproc_constants.CONST_DOUBLE6.GetType() );
|
||||
assert( typeof(bool) == preproc_constants.CONST_BOOL1.GetType() );
|
||||
assert( typeof(bool) == preproc_constants.CONST_BOOL2.GetType() );
|
||||
assert( typeof(char) == preproc_constants.CONST_CHAR.GetType() );
|
||||
assert( typeof(string) == preproc_constants.CONST_STRING1.GetType() );
|
||||
assert( typeof(string) == preproc_constants.CONST_STRING2.GetType() );
|
||||
|
||||
assert( typeof(int) == preproc_constants.INT_AND_BOOL.GetType() );
|
||||
// assert( typeof(int) == preproc_constants.INT_AND_CHAR.GetType() );
|
||||
assert( typeof(int) == preproc_constants.INT_AND_INT.GetType() );
|
||||
assert( typeof(uint) == preproc_constants.INT_AND_UINT.GetType() );
|
||||
assert( typeof(int) == preproc_constants.INT_AND_LONG.GetType() );
|
||||
assert( typeof(uint) == preproc_constants.INT_AND_ULONG.GetType() );
|
||||
assert( typeof(long) == preproc_constants.INT_AND_LLONG.GetType() );
|
||||
assert( typeof(ulong) == preproc_constants.INT_AND_ULLONG.GetType() );
|
||||
assert( typeof(int ) == preproc_constants.BOOL_AND_BOOL.GetType() );
|
||||
|
||||
assert( typeof(int) == preproc_constants.EXPR_MULTIPLY.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_DIVIDE.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_PLUS.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_MINUS.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_LSHIFT.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_RSHIFT.GetType() );
|
||||
assert( typeof(bool) == preproc_constants.EXPR_LTE.GetType() );
|
||||
assert( typeof(bool) == preproc_constants.EXPR_GTE.GetType() );
|
||||
assert( typeof(bool) == preproc_constants.EXPR_INEQUALITY.GetType() );
|
||||
assert( typeof(bool) == preproc_constants.EXPR_EQUALITY.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_AND.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_XOR.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_OR.GetType() );
|
||||
assert( typeof(bool) == preproc_constants.EXPR_LAND.GetType() );
|
||||
assert( typeof(bool) == preproc_constants.EXPR_LOR.GetType() );
|
||||
assert( typeof(double) == preproc_constants.EXPR_CONDITIONAL.GetType() );
|
||||
|
||||
}
|
||||
static void assert(bool assertion) {
|
||||
if (!assertion)
|
||||
throw new ApplicationException("test failed");
|
||||
}
|
||||
}
|
||||
22
Examples/test-suite/csharp/special_variable_macros_runme.cs
Normal file
22
Examples/test-suite/csharp/special_variable_macros_runme.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using special_variable_macrosNamespace;
|
||||
|
||||
public class runme {
|
||||
static void Main() {
|
||||
Name name = new Name();
|
||||
if (special_variable_macros.testFred(name) != "none")
|
||||
throw new Exception("test failed");
|
||||
if (special_variable_macros.testJack(name) != "$specialname")
|
||||
throw new Exception("test failed");
|
||||
if (special_variable_macros.testJill(name) != "jilly")
|
||||
throw new Exception("test failed");
|
||||
if (special_variable_macros.testMary(name) != "SWIGTYPE_p_NameWrap")
|
||||
throw new Exception("test failed");
|
||||
if (special_variable_macros.testJim(name) != "multiname num")
|
||||
throw new Exception("test failed");
|
||||
if (special_variable_macros.testJohn(new PairIntBool(10, false)) != 123)
|
||||
throw new Exception("test failed");
|
||||
NewName newName = NewName.factory("factoryname");
|
||||
name = newName.getStoredName();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%module csharp_attributes
|
||||
%module(directors="1") csharp_attributes
|
||||
|
||||
// Test the inattributes and outattributes typemaps
|
||||
%typemap(cstype, outattributes="[IntOut]", inattributes="[IntIn]") int "int"
|
||||
|
|
@ -15,6 +15,8 @@ public:
|
|||
int GlobalFunction(int myInt) { return myInt; }
|
||||
%}
|
||||
|
||||
//%include "enumsimple.swg"
|
||||
//%include "enumtypesafe.swg"
|
||||
|
||||
// Test the attributes feature
|
||||
%csattributes MoreStations::MoreStations() "[InterCity1]"
|
||||
|
|
@ -25,6 +27,8 @@ int GlobalFunction(int myInt) { return myInt; }
|
|||
%csattributes Wales "[InterCity6]"
|
||||
%csattributes Paddington() "[InterCity7]"
|
||||
%csattributes DidcotParkway "[InterCity8]"
|
||||
%csattributes MoreStations::Cardiff "[System.ComponentModel.Description(\"Cardiff city station\")]"
|
||||
%csattributes Swansea "[System.ComponentModel.Description(\"Swansea city station\")]"
|
||||
|
||||
%typemap(csattributes) MoreStations "[Eurostar1]"
|
||||
%typemap(csattributes) MoreStations::Wales "[Eurostar2]"
|
||||
|
|
@ -46,3 +50,13 @@ enum Cymru { Llanelli };
|
|||
double MoreStations::WestonSuperMare = 0.0;
|
||||
%}
|
||||
|
||||
// Test directorinattributes and directoroutattributes
|
||||
%typemap(imtype, directoroutattributes="[DirectorIntegerOut]", directorinattributes="[DirectorIntegerIn]") int "int"
|
||||
%feature("director") YetMoreStations;
|
||||
|
||||
%inline %{
|
||||
struct YetMoreStations {
|
||||
virtual int Slough(int x) {}
|
||||
virtual ~YetMoreStations() {}
|
||||
};
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@
|
|||
"$csclassname.getCPtr(d$csinput)"
|
||||
|
||||
// post only in csin typemap
|
||||
%typemap(csin, post=" int size = $csinput.Count;\n for (int i=0; i<size; ++i) {\n $csinput[i] /= 100;\n }") std::vector<double> &vpost
|
||||
%typemap(csin, post=" int size = $csinput.Count;\n"
|
||||
" for (int i=0; i<size; ++i) {\n"
|
||||
" $csinput[i] /= 100;\n"
|
||||
" }") std::vector<double> &vpost
|
||||
"$csclassname.getCPtr($csinput)"
|
||||
|
||||
%inline %{
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@
|
|||
|
||||
|
||||
// tests valuewrapper
|
||||
%feature("compactdefaultargs") MyClass2::set;
|
||||
%inline %{
|
||||
enum MyType { Val1, Val2 };
|
||||
|
||||
|
|
@ -134,6 +135,7 @@
|
|||
void set(MyClass1 cl1 = Val1) {}
|
||||
// This could have been written : set(MyClass1 cl1 = MyClass1(Val1))
|
||||
// But it works in C++ since there is a "conversion" constructor in MyClass1.
|
||||
void set2(MyClass1 cl1 = Val1) {}
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ This was reported in bug #909389 */
|
|||
|
||||
%module derived_nested
|
||||
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::CC;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::DD;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::EE;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::FF;
|
||||
|
||||
%inline %{
|
||||
|
||||
class A { int x; };
|
||||
|
|
@ -11,5 +16,12 @@ class B {
|
|||
class D : public A { int z; }; //ok
|
||||
};
|
||||
|
||||
struct BB {
|
||||
class CC { int y; };
|
||||
class DD : public A { int z; };
|
||||
struct EE : public A { int z; };
|
||||
struct FF : public A { int z; } ff_instance; // Bug 1960977
|
||||
void useEE(const EE& e) {}
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@
|
|||
%feature("director") Foo;
|
||||
|
||||
%newobject Foo::cloner();
|
||||
%newobject Foo::get_class();
|
||||
%newobject Bar::cloner();
|
||||
%newobject Bar::get_class();
|
||||
|
||||
|
||||
%inline {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,13 @@
|
|||
|
||||
%newobject *::create();
|
||||
|
||||
#ifdef SWIGPHP
|
||||
// TODO: Currently we do not track the dynamic type of returned objects
|
||||
// in PHP, so we need the factory helper.
|
||||
%include factory.i
|
||||
%factory(Foo *Bar::create, Bar);
|
||||
#endif
|
||||
|
||||
%rename(a) Bar::hello;
|
||||
%rename(s) Foo::p;
|
||||
%rename(q) Foo::r;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@
|
|||
%feature("director") Foo;
|
||||
|
||||
%feature("director:except") {
|
||||
#ifndef SWIGPHP
|
||||
if ($error != NULL) {
|
||||
#else
|
||||
if ($error == FAILURE) {
|
||||
#endif
|
||||
throw Swig::DirectorMethodException();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
%module(directors="1",dirprot="1") director_using
|
||||
|
||||
%warnfilter(SWIGWARN_PHP_PUBLIC_BASE) FooBar;
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -487,11 +487,53 @@ struct Instances {
|
|||
// Repeated values
|
||||
#if defined(SWIGJAVA)
|
||||
%javaconst(1);
|
||||
// needed for typesafe and proper enums only
|
||||
%javaconst(0) ignoreA_three;
|
||||
%javaconst(0) ignoreA_thirteen;
|
||||
#elif defined(SWIGCSHARP)
|
||||
// needed for typesafe enums only
|
||||
#ifdef SWIG_TEST_NOCSCONST
|
||||
%csconst(0) ignoreA_three;
|
||||
%csconst(0) ignoreA_thirteen;
|
||||
#endif
|
||||
%csconst(1);
|
||||
#endif
|
||||
|
||||
#if defined(SWIGPERL)
|
||||
%ignore ignoreA_one;
|
||||
%ignore ignoreA_two;
|
||||
%ignore ignoreA_twelve;
|
||||
%ignore ignoreA_thirty_one;
|
||||
|
||||
%ignore ignoreB_ten;
|
||||
%ignore ignoreB_twenty;
|
||||
%ignore ignoreB_thirty;
|
||||
%ignore ignoreB_forty;
|
||||
|
||||
%ignore ignoreC_eleven;
|
||||
%ignore ignoreC_thirty_one;
|
||||
%ignore ignoreC_forty_one;
|
||||
|
||||
%ignore ignoreD_ten;
|
||||
%ignore ignoreD_twenty;
|
||||
|
||||
%ignore ignoreE_twenty;
|
||||
|
||||
%inline %{
|
||||
struct IgnoreTest {
|
||||
enum IgnoreA { ignoreA_zero, ignoreA_one, ignoreA_two, ignoreA_three, ignoreA_ten=10, ignoreA_eleven, ignoreA_twelve, ignoreA_thirteen, ignoreA_fourteen, ignoreA_twenty=20, ignoreA_thirty=30, ignoreA_thirty_one, ignoreA_thirty_two, ignoreA_thirty_three };
|
||||
enum IgnoreB { ignoreB_ten=10, ignoreB_eleven, ignoreB_twelve, ignoreB_twenty=20, ignoreB_thirty=30, ignoreB_thirty_one, ignoreB_thirty_two, ignoreB_forty=40, ignoreB_forty_one, ignoreB_forty_two };
|
||||
enum IgnoreC { ignoreC_ten=10, ignoreC_eleven, ignoreC_twelve, ignoreC_twenty=20, ignoreC_thirty=30, ignoreC_thirty_one, ignoreC_thirty_two, ignoreC_forty=40, ignoreC_forty_one, ignoreC_forty_two };
|
||||
enum IgnoreD { ignoreD_ten=10, ignoreD_twenty=20, ignoreD_twenty_one, ignoreD_twenty_two };
|
||||
enum IgnoreE { ignoreE_zero, ignoreE_twenty=20, ignoreE_twenty_one, ignoreE_twenty_two };
|
||||
};
|
||||
|
||||
IgnoreTest::IgnoreA ignoreATest(IgnoreTest::IgnoreA n) { return n; }
|
||||
IgnoreTest::IgnoreB ignoreBTest(IgnoreTest::IgnoreB n) { return n; }
|
||||
IgnoreTest::IgnoreC ignoreCTest(IgnoreTest::IgnoreC n) { return n; }
|
||||
IgnoreTest::IgnoreD ignoreDTest(IgnoreTest::IgnoreD n) { return n; }
|
||||
IgnoreTest::IgnoreE ignoreETest(IgnoreTest::IgnoreE n) { return n; }
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
|
||||
namespace RepeatSpace {
|
||||
|
|
@ -509,24 +551,3 @@ repeat repeatTest(repeat e) { return e; }
|
|||
|
||||
%}
|
||||
|
||||
#else
|
||||
%inline %{
|
||||
|
||||
namespace RepeatSpace {
|
||||
typedef enum
|
||||
{
|
||||
one = 1,
|
||||
initial = one,
|
||||
two,
|
||||
three,
|
||||
last = three,
|
||||
end = last
|
||||
} repeat;
|
||||
repeat repeatTest(repeat e) { return e; }
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -3,5 +3,7 @@
|
|||
// Test enum wrapping using the typesafe enum pattern in the target language
|
||||
%include "enumtypesafe.swg"
|
||||
|
||||
#define SWIG_TEST_NOCSCONST // For C# typesafe enums
|
||||
|
||||
%include "enum_thorough.i"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) globalinstance1;
|
||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) globalinstance2;
|
||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) globalinstance3;
|
||||
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK);
|
||||
|
||||
%inline %{
|
||||
|
||||
|
|
@ -32,8 +33,14 @@ bar3(foo3 x) {}
|
|||
|
||||
enum sad { boo, hoo = 5 };
|
||||
|
||||
#ifdef __cplusplus /* For Octave and g++ which compiles C test code as C++ */
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Unnamed enum instance */
|
||||
enum { globalinstance1, globalinstance2, globalinstance3 = 30 } GlobalInstance;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Anonymous enum */
|
||||
enum { AnonEnum1, AnonEnum2 = 100 };
|
||||
|
|
@ -58,7 +65,7 @@ typedef struct _iFoo
|
|||
enum {
|
||||
Phoo = +50,
|
||||
Char = 'a'
|
||||
} e;
|
||||
} e;
|
||||
} iFoo;
|
||||
%}
|
||||
#else
|
||||
|
|
@ -71,5 +78,20 @@ struct iFoo
|
|||
};
|
||||
};
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
// enum declaration and initialization
|
||||
%inline %{
|
||||
enum Exclamation {
|
||||
goodness,
|
||||
gracious,
|
||||
me
|
||||
} enumInstance = me;
|
||||
|
||||
enum ContainYourself {
|
||||
slap = 10,
|
||||
my,
|
||||
thigh
|
||||
} Slap = slap, My = my, Thigh = thigh, *pThigh = &Thigh, arrayContainYourself[3] = {slap, my, thigh};
|
||||
%}
|
||||
|
||||
|
|
|
|||
16
Examples/test-suite/extern_c.i
Normal file
16
Examples/test-suite/extern_c.i
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
%module extern_c
|
||||
|
||||
%inline %{
|
||||
extern "C" {
|
||||
void RealFunction(int value);
|
||||
typedef void Function1(int value); // Fails
|
||||
typedef int Integer1;
|
||||
}
|
||||
typedef void Function2(int value); // Works
|
||||
typedef int Integer2;
|
||||
%}
|
||||
|
||||
%{
|
||||
void RealFunction(int value) {}
|
||||
%}
|
||||
|
||||
|
|
@ -11,8 +11,8 @@ class Klass6 {};
|
|||
class Klass7 {};
|
||||
|
||||
struct KlassMethods {
|
||||
static void methodA(::Klass1 v, const ::Klass2 cv, const ::Klass3 *cp, ::Klass4 *p, const ::Klass5 &cr, ::Klass6 &r, Klass7*& pr) {}
|
||||
static void methodB( Klass1 v, const Klass2 cv, const Klass3 *cp, Klass4 *p, const Klass5 &cr, Klass6 &r, Klass7*& pr) {}
|
||||
static void methodA(::Klass1 v, const ::Klass2 cv, const ::Klass3 *cp, ::Klass4 *p, const ::Klass5 &cr, ::Klass6 &r, ::Klass7*& pr) {}
|
||||
static void methodB( Klass1 v, const Klass2 cv, const Klass3 *cp, Klass4 *p, const Klass5 &cr, Klass6 &r, Klass7*& pr) {}
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
@ -28,8 +28,8 @@ class XYZ7 {};
|
|||
}
|
||||
|
||||
struct XYZMethods {
|
||||
static void methodA(::Space::XYZ1 v, const ::Space::XYZ2 cv, const ::Space::XYZ3 *cp, ::Space::XYZ4 *p, const ::Space::XYZ5 &cr, ::Space::XYZ6 &r, Space::XYZ7*& pr) {}
|
||||
static void methodB( Space::XYZ1 v, const Space::XYZ2 cv, const Space::XYZ3 *cp, Space::XYZ4 *p, const Space::XYZ5 &cr, Space::XYZ6 &r, Space::XYZ7*& pr) {}
|
||||
static void methodA(::Space::XYZ1 v, const ::Space::XYZ2 cv, const ::Space::XYZ3 *cp, ::Space::XYZ4 *p, const ::Space::XYZ5 &cr, ::Space::XYZ6 &r, ::Space::XYZ7*& pr) {}
|
||||
static void methodB( Space::XYZ1 v, const Space::XYZ2 cv, const Space::XYZ3 *cp, Space::XYZ4 *p, const Space::XYZ5 &cr, Space::XYZ6 &r, Space::XYZ7*& pr) {}
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
44
Examples/test-suite/global_scope_types.i
Normal file
44
Examples/test-suite/global_scope_types.i
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
%module global_scope_types
|
||||
|
||||
// no constructor/destructor wrappers as they do not use global scope operator which we are trying to test here
|
||||
%nodefaultctor Dingaling;
|
||||
%nodefaultdtor Dingaling;
|
||||
|
||||
%inline %{
|
||||
struct Dingaling {};
|
||||
typedef Dingaling DINGALING;
|
||||
template <typename T> struct MyTemplate {
|
||||
T tt(T t) { return t; }
|
||||
T& ttr(T& t) { return t; }
|
||||
};
|
||||
|
||||
#ifndef SWIG
|
||||
// This is added so that the code will not compile, if the global scope operator on Dingaling is omitted in the generated code
|
||||
namespace Spac {
|
||||
class Dingaling {
|
||||
Dingaling();
|
||||
Dingaling(const Dingaling& t);
|
||||
Dingaling& operator=(const Dingaling t);
|
||||
};
|
||||
}
|
||||
using namespace Spac;
|
||||
#endif
|
||||
|
||||
namespace Spac {
|
||||
|
||||
struct Ting {};
|
||||
typedef Ting TING;
|
||||
|
||||
class Test {
|
||||
public:
|
||||
void something(::Dingaling t, ::Dingaling* pt, ::Dingaling& rt, const ::Dingaling& crt) {}
|
||||
void tsomething(MyTemplate< ::Dingaling > t1, MyTemplate< const ::Dingaling* > t2) {}
|
||||
// void usomething(::MyTemplate< ::DINGALING > t3, ::MyTemplate< ::DINGALING *> t4) {} // needs fixing
|
||||
void nothing(::Spac::Ting*, ::Spac::TING&) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void funcptrtest( void (*)(::Dingaling) ) {}
|
||||
%}
|
||||
|
||||
|
|
@ -9,14 +9,22 @@ srcdir = @srcdir@
|
|||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
GUILE = @GUILE@
|
||||
GUILE_RUNTIME=-runtime
|
||||
|
||||
C_TEST_CASES = long_long \
|
||||
list_vector \
|
||||
multivalue \
|
||||
pointer_in_out
|
||||
|
||||
C_TEST_CASES = long_long list_vector pointer_in_out multivalue
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Overridden variables here
|
||||
# none!
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
%.multicpptest: SWIGOPT += $(GUILE_RUNTIME)
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
@ -28,19 +36,6 @@ include $(srcdir)/../common.mk
|
|||
+$(swig_and_compile_c)
|
||||
$(run_testcase)
|
||||
|
||||
# override the default in common.mk by adding SWIGOPT +=
|
||||
swig_and_compile_multi_cpp = \
|
||||
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
|
||||
SWIGOPT=" -runtime "; \
|
||||
export SWIGOPT; \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $$SWIGOPT" NOLINK=true \
|
||||
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
|
||||
$(LANGUAGE)$(VARIANT)_cpp; \
|
||||
SWIGOPT=" -noruntime "; \
|
||||
done
|
||||
|
||||
%.multicpptest:
|
||||
$(setup)
|
||||
+$(swig_and_compile_multi_cpp)
|
||||
|
|
@ -49,9 +44,9 @@ swig_and_compile_multi_cpp = \
|
|||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.scm appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
||||
# Clean
|
||||
%.clean:
|
||||
|
|
|
|||
|
|
@ -6,34 +6,29 @@ EXTRA_TEST_CASES += guilescm_ext_test.externaltest
|
|||
|
||||
include ../guile/Makefile
|
||||
|
||||
# Overridden variables here
|
||||
INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guilescm
|
||||
|
||||
VARIANT =
|
||||
# Refer to the guile directory for the run scripts
|
||||
SCRIPTPREFIX = ../guile/
|
||||
GUILE_RUNTIME=
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
||||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.scm appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
||||
setup = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with SCM API)" ; \
|
||||
fi;
|
||||
|
||||
swig_and_compile_multi_cpp = \
|
||||
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $$SWIGOPT" NOLINK=true \
|
||||
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
|
||||
$(LANGUAGE)$(VARIANT)_cpp; \
|
||||
done
|
||||
fi
|
||||
|
||||
%.externaltest:
|
||||
$(local_setup)
|
||||
|
|
@ -46,9 +41,9 @@ local_setup = \
|
|||
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with SCM API)" ; \
|
||||
fi;
|
||||
fi
|
||||
|
||||
local_run_testcase = \
|
||||
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$*$(SCRIPTSUFFIX);) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ include $(srcdir)/../common.mk
|
|||
SWIGOPT += -package $*
|
||||
INTERFACEDIR = ../../
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
@ -64,24 +67,24 @@ setup = \
|
|||
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
|
||||
fi; \
|
||||
if [ ! -d $* ]; then \
|
||||
mkdir $*; \
|
||||
fi;
|
||||
mkdir $*; \
|
||||
fi
|
||||
|
||||
# Compiles java files then runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.java appended after the testcase name.
|
||||
# Note Java uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows, SHLIB_PATH on HPUX and DYLD_LIBRARY_PATH on Mac OS X.
|
||||
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;) \
|
||||
fi;
|
||||
cd $* && $(COMPILETOOL) $(JAVAC) -classpath . *.java && cd .. && \
|
||||
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; \
|
||||
fi
|
||||
|
||||
# Clean: remove testcase directories
|
||||
%.clean:
|
||||
@if [ -d $* ]; then \
|
||||
rm -rf $*; \
|
||||
fi;
|
||||
rm -rf $*; \
|
||||
fi
|
||||
|
||||
clean:
|
||||
@rm -f *.class hs_err*.log
|
||||
|
|
|
|||
|
|
@ -127,15 +127,26 @@ public class char_strings_runme {
|
|||
|
||||
// char *& tests
|
||||
for (i=0; i<count; i++) {
|
||||
String str = char_strings.GetConstCharPointerRef();
|
||||
String str = char_strings.GetCharPointerRef();
|
||||
if (!str.equals(CPLUSPLUS_MSG))
|
||||
throw new RuntimeException("Test char pointer ref get failed, iteration " + i);
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i))
|
||||
if (!char_strings.SetCharPointerRef(OTHERLAND_MSG + i, i))
|
||||
throw new RuntimeException("Test char pointer ref set failed, iteration " + i);
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
String str = char_strings.GetConstCharPointerRef();
|
||||
if (!str.equals(CPLUSPLUS_MSG))
|
||||
throw new RuntimeException("Test const char pointer ref get failed, iteration " + i);
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i))
|
||||
throw new RuntimeException("Test const char pointer ref set failed, iteration " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -369,12 +369,51 @@ public class enum_thorough_proper_runme {
|
|||
i.setMemberInstance(Instances.memberinstance3);
|
||||
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
|
||||
}
|
||||
// ignore enum item tests start
|
||||
{
|
||||
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue() != 0) throw new RuntimeException("ignoreATest 0 failed");
|
||||
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue() != 3) throw new RuntimeException("ignoreATest 3 failed");
|
||||
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue() != 10) throw new RuntimeException("ignoreATest 10 failed");
|
||||
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue() != 11) throw new RuntimeException("ignoreATest 11 failed");
|
||||
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue() != 13) throw new RuntimeException("ignoreATest 13 failed");
|
||||
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue() != 14) throw new RuntimeException("ignoreATest 14 failed");
|
||||
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue() != 20) throw new RuntimeException("ignoreATest 20 failed");
|
||||
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue() != 30) throw new RuntimeException("ignoreATest 30 failed");
|
||||
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreATest 32 failed");
|
||||
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue() != 33) throw new RuntimeException("ignoreATest 33 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue() != 11) throw new RuntimeException("ignoreBTest 11 failed");
|
||||
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue() != 12) throw new RuntimeException("ignoreBTest 12 failed");
|
||||
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue() != 31) throw new RuntimeException("ignoreBTest 31 failed");
|
||||
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreBTest 32 failed");
|
||||
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue() != 41) throw new RuntimeException("ignoreBTest 41 failed");
|
||||
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue() != 42) throw new RuntimeException("ignoreBTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue() != 10) throw new RuntimeException("ignoreCTest 10 failed");
|
||||
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue() != 12) throw new RuntimeException("ignoreCTest 12 failed");
|
||||
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue() != 30) throw new RuntimeException("ignoreCTest 30 failed");
|
||||
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreCTest 32 failed");
|
||||
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue() != 40) throw new RuntimeException("ignoreCTest 40 failed");
|
||||
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue() != 42) throw new RuntimeException("ignoreCTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_proper.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreDTest 21 failed");
|
||||
if (enum_thorough_proper.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreDTest 22 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue() != 0) throw new RuntimeException("ignoreETest 0 failed");
|
||||
if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreETest 21 failed");
|
||||
if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreETest 22 failed");
|
||||
}
|
||||
// ignore enum item tests end
|
||||
{
|
||||
if (enum_thorough_proper.repeatTest(repeat.one).swigValue() != 1) throw new RuntimeException("repeatTest 1 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.two).swigValue() != 2) throw new RuntimeException("repeatTest 3 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.three).swigValue() != 3) throw new RuntimeException("repeatTest 4 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.last).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.llast).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,12 +369,51 @@ public class enum_thorough_runme {
|
|||
i.setMemberInstance(Instances.memberinstance3);
|
||||
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
|
||||
}
|
||||
// ignore enum item tests start
|
||||
{
|
||||
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue() != 0) throw new RuntimeException("ignoreATest 0 failed");
|
||||
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue() != 3) throw new RuntimeException("ignoreATest 3 failed");
|
||||
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue() != 10) throw new RuntimeException("ignoreATest 10 failed");
|
||||
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue() != 11) throw new RuntimeException("ignoreATest 11 failed");
|
||||
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue() != 13) throw new RuntimeException("ignoreATest 13 failed");
|
||||
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue() != 14) throw new RuntimeException("ignoreATest 14 failed");
|
||||
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue() != 20) throw new RuntimeException("ignoreATest 20 failed");
|
||||
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue() != 30) throw new RuntimeException("ignoreATest 30 failed");
|
||||
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreATest 32 failed");
|
||||
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue() != 33) throw new RuntimeException("ignoreATest 33 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue() != 11) throw new RuntimeException("ignoreBTest 11 failed");
|
||||
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue() != 12) throw new RuntimeException("ignoreBTest 12 failed");
|
||||
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue() != 31) throw new RuntimeException("ignoreBTest 31 failed");
|
||||
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreBTest 32 failed");
|
||||
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue() != 41) throw new RuntimeException("ignoreBTest 41 failed");
|
||||
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue() != 42) throw new RuntimeException("ignoreBTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue() != 10) throw new RuntimeException("ignoreCTest 10 failed");
|
||||
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue() != 12) throw new RuntimeException("ignoreCTest 12 failed");
|
||||
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue() != 30) throw new RuntimeException("ignoreCTest 30 failed");
|
||||
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreCTest 32 failed");
|
||||
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue() != 40) throw new RuntimeException("ignoreCTest 40 failed");
|
||||
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue() != 42) throw new RuntimeException("ignoreCTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreDTest 21 failed");
|
||||
if (enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreDTest 22 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue() != 0) throw new RuntimeException("ignoreETest 0 failed");
|
||||
if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreETest 21 failed");
|
||||
if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreETest 22 failed");
|
||||
}
|
||||
// ignore enum item tests end
|
||||
{
|
||||
if (enum_thorough.repeatTest(repeat.one).swigValue() != 1) throw new RuntimeException("repeatTest 1 failed");
|
||||
if (enum_thorough.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
|
||||
if (enum_thorough.repeatTest(repeat.two).swigValue() != 2) throw new RuntimeException("repeatTest 3 failed");
|
||||
if (enum_thorough.repeatTest(repeat.three).swigValue() != 3) throw new RuntimeException("repeatTest 4 failed");
|
||||
if (enum_thorough.repeatTest(repeat.last).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough.repeatTest(repeat.llast).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,12 +369,51 @@ public class enum_thorough_simple_runme {
|
|||
i.setMemberInstance(Instances.memberinstance3);
|
||||
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
|
||||
}
|
||||
// ignore enum item tests start
|
||||
{
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_zero) != 0) throw new RuntimeException("ignoreATest 0 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_three) != 3) throw new RuntimeException("ignoreATest 3 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_ten) != 10) throw new RuntimeException("ignoreATest 10 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_eleven) != 11) throw new RuntimeException("ignoreATest 11 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirteen) != 13) throw new RuntimeException("ignoreATest 13 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_fourteen) != 14) throw new RuntimeException("ignoreATest 14 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_twenty) != 20) throw new RuntimeException("ignoreATest 20 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty) != 30) throw new RuntimeException("ignoreATest 30 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_two) != 32) throw new RuntimeException("ignoreATest 32 failed");
|
||||
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_three) != 33) throw new RuntimeException("ignoreATest 33 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_eleven) != 11) throw new RuntimeException("ignoreBTest 11 failed");
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_twelve) != 12) throw new RuntimeException("ignoreBTest 12 failed");
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_one) != 31) throw new RuntimeException("ignoreBTest 31 failed");
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_two) != 32) throw new RuntimeException("ignoreBTest 32 failed");
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_one) != 41) throw new RuntimeException("ignoreBTest 41 failed");
|
||||
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_two) != 42) throw new RuntimeException("ignoreBTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_ten) != 10) throw new RuntimeException("ignoreCTest 10 failed");
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_twelve) != 12) throw new RuntimeException("ignoreCTest 12 failed");
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty) != 30) throw new RuntimeException("ignoreCTest 30 failed");
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty_two) != 32) throw new RuntimeException("ignoreCTest 32 failed");
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty) != 40) throw new RuntimeException("ignoreCTest 40 failed");
|
||||
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty_two) != 42) throw new RuntimeException("ignoreCTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_one) != 21) throw new RuntimeException("ignoreDTest 21 failed");
|
||||
if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_two) != 22) throw new RuntimeException("ignoreDTest 22 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_zero) != 0) throw new RuntimeException("ignoreETest 0 failed");
|
||||
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_one) != 21) throw new RuntimeException("ignoreETest 21 failed");
|
||||
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_two) != 22) throw new RuntimeException("ignoreETest 22 failed");
|
||||
}
|
||||
// ignore enum item tests end
|
||||
{
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.one) != 1) throw new RuntimeException("repeatTest 1 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.two) != 2) throw new RuntimeException("repeatTest 3 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.three) != 3) throw new RuntimeException("repeatTest 4 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.last) != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.llast) != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.end) != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,12 +369,51 @@ public class enum_thorough_typeunsafe_runme {
|
|||
i.setMemberInstance(Instances.memberinstance3);
|
||||
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
|
||||
}
|
||||
// ignore enum item tests start
|
||||
{
|
||||
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero) != 0) throw new RuntimeException("ignoreATest 0 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three) != 3) throw new RuntimeException("ignoreATest 3 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten) != 10) throw new RuntimeException("ignoreATest 10 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven) != 11) throw new RuntimeException("ignoreATest 11 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen) != 13) throw new RuntimeException("ignoreATest 13 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen) != 14) throw new RuntimeException("ignoreATest 14 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty) != 20) throw new RuntimeException("ignoreATest 20 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty) != 30) throw new RuntimeException("ignoreATest 30 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two) != 32) throw new RuntimeException("ignoreATest 32 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three) != 33) throw new RuntimeException("ignoreATest 33 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven) != 11) throw new RuntimeException("ignoreBTest 11 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve) != 12) throw new RuntimeException("ignoreBTest 12 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one) != 31) throw new RuntimeException("ignoreBTest 31 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two) != 32) throw new RuntimeException("ignoreBTest 32 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one) != 41) throw new RuntimeException("ignoreBTest 41 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two) != 42) throw new RuntimeException("ignoreBTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten) != 10) throw new RuntimeException("ignoreCTest 10 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve) != 12) throw new RuntimeException("ignoreCTest 12 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty) != 30) throw new RuntimeException("ignoreCTest 30 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two) != 32) throw new RuntimeException("ignoreCTest 32 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty) != 40) throw new RuntimeException("ignoreCTest 40 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two) != 42) throw new RuntimeException("ignoreCTest 42 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typeunsafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one) != 21) throw new RuntimeException("ignoreDTest 21 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two) != 22) throw new RuntimeException("ignoreDTest 22 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero) != 0) throw new RuntimeException("ignoreETest 0 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one) != 21) throw new RuntimeException("ignoreETest 21 failed");
|
||||
if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two) != 22) throw new RuntimeException("ignoreETest 22 failed");
|
||||
}
|
||||
// ignore enum item tests end
|
||||
{
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.one) != 1) throw new RuntimeException("repeatTest 1 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.two) != 2) throw new RuntimeException("repeatTest 3 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.three) != 3) throw new RuntimeException("repeatTest 4 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.last) != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.llast) != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.end) != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,12 @@ public class java_director_runme {
|
|||
System.gc();
|
||||
System.runFinalization();
|
||||
|
||||
// Give the finalizers a chance to run
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
/* Watch the Quux objects formerly in the QuuxContainer object
|
||||
get reaped */
|
||||
System.gc();
|
||||
|
|
@ -73,3 +79,14 @@ class java_director_MyQuux extends Quux {
|
|||
return "java_director_MyQuux:" + member();
|
||||
}
|
||||
}
|
||||
|
||||
class java_director_JavaExceptionTest extends JavaExceptionTest {
|
||||
public java_director_JavaExceptionTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void etest() throws Exception {
|
||||
super.etest();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class java_jnitypes_runme {
|
|||
double doubleArray[] = new double[] {10.0, 20.0};
|
||||
Test objectArray[] = new Test[] {new Test(), test};
|
||||
|
||||
if (java_jnitypes.jnifunc(true) != true) testFailed("jboolean");
|
||||
if (java_jnitypes.jnifunc_bool(true) != true) testFailed("jboolean");
|
||||
if (java_jnitypes.jnifunc('A') != 'A') testFailed("jchar");
|
||||
if (java_jnitypes.jnifunc((byte)100) != (byte)100) testFailed("jbyte");
|
||||
if (java_jnitypes.jnifunc((short)100) != (short)100) testFailed("jshort");
|
||||
|
|
|
|||
|
|
@ -40,6 +40,16 @@ public class java_throws_runme {
|
|||
if (!pass)
|
||||
throw new RuntimeException("Test 2 failed");
|
||||
|
||||
// Check the exception class is used with %catches
|
||||
pass = false;
|
||||
try {
|
||||
java_throws.catches_function(100);
|
||||
}
|
||||
catch (IllegalAccessException e) { pass = true; }
|
||||
|
||||
if (!pass)
|
||||
throw new RuntimeException("Test 3 failed");
|
||||
|
||||
// Check newfree typemap throws attribute
|
||||
try {
|
||||
TestClass tc = java_throws.makeTestClass();
|
||||
|
|
|
|||
26
Examples/test-suite/java/memberin_extend_runme.java
Normal file
26
Examples/test-suite/java/memberin_extend_runme.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
import memberin_extend.*;
|
||||
|
||||
public class memberin_extend_runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("memberin_extend");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[])
|
||||
{
|
||||
ExtendMe em1 = new ExtendMe();
|
||||
ExtendMe em2 = new ExtendMe();
|
||||
em1.setThing("em1thing");
|
||||
em2.setThing("em2thing");
|
||||
if (!em1.getThing().equals("em1thing"))
|
||||
throw new RuntimeException("wrong: " + em1.getThing());
|
||||
if (!em2.getThing().equals("em2thing"))
|
||||
throw new RuntimeException("wrong: " + em2.getThing());
|
||||
}
|
||||
}
|
||||
|
||||
72
Examples/test-suite/java/nested_class_runme.java
Normal file
72
Examples/test-suite/java/nested_class_runme.java
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
|
||||
import nested_class.*;
|
||||
|
||||
public class nested_class_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("nested_class");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
Outer outer = new Outer();
|
||||
SWIGTYPE_p_Outer__InnerStruct1 is1 = outer.makeInnerStruct1();
|
||||
SWIGTYPE_p_Outer__InnerClass1 ic1 = outer.makeInnerClass1();
|
||||
SWIGTYPE_p_Outer__InnerUnion1 iu1 = outer.makeInnerUnion1();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerStruct2 is2 = outer.makeInnerStruct2();
|
||||
SWIGTYPE_p_Outer__InnerClass2 ic2 = outer.makeInnerClass2();
|
||||
SWIGTYPE_p_Outer__InnerUnion2 iu2 = outer.makeInnerUnion2();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerClass4Typedef ic4 = outer.makeInnerClass4Typedef();
|
||||
SWIGTYPE_p_Outer__InnerStruct4Typedef is4 = outer.makeInnerStruct4Typedef();
|
||||
SWIGTYPE_p_Outer__InnerUnion4Typedef iu4 = outer.makeInnerUnion4Typedef();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerClass5 ic5 = outer.makeInnerClass5();
|
||||
SWIGTYPE_p_Outer__InnerStruct5 is5 = outer.makeInnerStruct5();
|
||||
SWIGTYPE_p_Outer__InnerUnion5 iu5 = outer.makeInnerUnion5();
|
||||
|
||||
ic5 = outer.makeInnerClass5Typedef();
|
||||
is5 = outer.makeInnerStruct5Typedef();
|
||||
iu5 = outer.makeInnerUnion5Typedef();
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultiple im1 = outer.getMultipleInstance1();
|
||||
SWIGTYPE_p_Outer__InnerMultiple im2 = outer.getMultipleInstance2();
|
||||
SWIGTYPE_p_Outer__InnerMultiple im3 = outer.getMultipleInstance3();
|
||||
SWIGTYPE_p_Outer__InnerMultiple im4 = outer.getMultipleInstance4();
|
||||
}
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
|
||||
}
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
|
||||
}
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef1 mat1 = outer.makeInnerMultipleAnonTypedef1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef2 mat2 = outer.makeInnerMultipleAnonTypedef2();
|
||||
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef3 mat3 = outer.makeInnerMultipleAnonTypedef3();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt = outer.makeInnerMultipleNamedTypedef();
|
||||
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt1 = outer.makeInnerMultipleNamedTypedef1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt2 = outer.makeInnerMultipleNamedTypedef2();
|
||||
SWIGTYPE_p_p_Outer__InnerMultipleNamedTypedef mnt3 = outer.makeInnerMultipleNamedTypedef3();
|
||||
}
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerSameName isn = outer.makeInnerSameName();
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Examples/test-suite/java/nested_structs_runme.java
Normal file
37
Examples/test-suite/java/nested_structs_runme.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
import nested_structs.*;
|
||||
|
||||
public class nested_structs_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("nested_structs");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
Outer outer = new Outer();
|
||||
nested_structs.setValues(outer, 10);
|
||||
|
||||
Outer_inner1 inner1 = outer.getInner1();
|
||||
Outer_inner2 inner2 = outer.getInner2();
|
||||
Outer_inner3 inner3 = outer.getInner3();
|
||||
Outer_inner4 inner4 = outer.getInner4();
|
||||
if (inner1.getVal() != 10) throw new RuntimeException("failed inner1");
|
||||
if (inner2.getVal() != 20) throw new RuntimeException("failed inner2");
|
||||
if (inner3.getVal() != 20) throw new RuntimeException("failed inner3");
|
||||
if (inner4.getVal() != 40) throw new RuntimeException("failed inner4");
|
||||
|
||||
Outer_inside1 inside1 = outer.getInside1();
|
||||
Outer_inside2 inside2 = outer.getInside2();
|
||||
Outer_inside3 inside3 = outer.getInside3();
|
||||
Outer_inside4 inside4 = outer.getInside4();
|
||||
if (inside1.getVal() != 100) throw new RuntimeException("failed inside1");
|
||||
if (inside2.getVal() != 200) throw new RuntimeException("failed inside2");
|
||||
if (inside3.getVal() != 200) throw new RuntimeException("failed inside3");
|
||||
if (inside4.getVal() != 400) throw new RuntimeException("failed inside4");
|
||||
}
|
||||
}
|
||||
31
Examples/test-suite/java/nested_workaround_runme.java
Normal file
31
Examples/test-suite/java/nested_workaround_runme.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import nested_workaround.*;
|
||||
|
||||
public class nested_workaround_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("nested_workaround");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
{
|
||||
Inner inner = new Inner(5);
|
||||
Outer outer = new Outer();
|
||||
Inner newInner = outer.doubleInnerValue(inner);
|
||||
if (newInner.getValue() != 10)
|
||||
throw new RuntimeException("inner failed");
|
||||
}
|
||||
|
||||
{
|
||||
Outer outer = new Outer();
|
||||
Inner inner = outer.createInner(3);
|
||||
Inner newInner = outer.doubleInnerValue(inner);
|
||||
if (outer.getInnerValue(newInner) != 6)
|
||||
throw new RuntimeException("inner failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,8 +16,8 @@ public class overload_template_runme {
|
|||
public static void main(String argv[]) {
|
||||
int f = overload_template.foo();
|
||||
|
||||
int a = overload_template.max(3,4);
|
||||
double b = overload_template.max(3.4,5.2);
|
||||
int a = overload_template.maximum(3,4);
|
||||
double b = overload_template.maximum(3.4,5.2);
|
||||
|
||||
// mix 1
|
||||
if (overload_template.mix1("hi") != 101)
|
||||
|
|
|
|||
32
Examples/test-suite/java/special_variable_macros_runme.java
Normal file
32
Examples/test-suite/java/special_variable_macros_runme.java
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
import special_variable_macros.*;
|
||||
|
||||
public class special_variable_macros_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("special_variable_macros");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
Name name = new Name();
|
||||
if (!special_variable_macros.testFred(name).equals("none"))
|
||||
throw new RuntimeException("test failed");
|
||||
if (!special_variable_macros.testJack(name).equals("$specialname"))
|
||||
throw new RuntimeException("test failed");
|
||||
if (!special_variable_macros.testJill(name).equals("jilly"))
|
||||
throw new RuntimeException("test failed");
|
||||
if (!special_variable_macros.testMary(name).equals("SWIGTYPE_p_NameWrap"))
|
||||
throw new RuntimeException("test failed");
|
||||
if (!special_variable_macros.testJim(name).equals("multiname num"))
|
||||
throw new RuntimeException("test failed");
|
||||
if (special_variable_macros.testJohn(new PairIntBool(10, false)) != 123)
|
||||
throw new RuntimeException("test failed");
|
||||
NewName newName = NewName.factory("factoryname");
|
||||
name = newName.getStoredName();
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,13 @@ public class template_methods_runme {
|
|||
k.KlassTMethodBool();
|
||||
b = Klass.KlassStaticTMethodBoolRenamed(true);
|
||||
Klass.KlassStaticTMethodBool();
|
||||
|
||||
|
||||
//
|
||||
ComponentProperties cp = new ComponentProperties();
|
||||
cp.adda("key1", "val1", "key2", 22.2);
|
||||
cp.adda("key1", "val1", "key2", "val2", "key3", "val3");
|
||||
cp.adda("key1", 1, "key2", 2, "key3", 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
30
Examples/test-suite/java/template_nested_runme.java
Normal file
30
Examples/test-suite/java/template_nested_runme.java
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
import template_nested.*;
|
||||
|
||||
public class template_nested_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_nested");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
new T_NormalTemplateNormalClass().tmethod(new NormalClass());
|
||||
new OuterClass().T_OuterTMethodNormalClass(new NormalClass());
|
||||
|
||||
TemplateFuncs tf = new TemplateFuncs();
|
||||
if (tf.T_TemplateFuncs1Int(-10) != -10)
|
||||
throw new RuntimeException("it failed");
|
||||
if (tf.T_TemplateFuncs2Double(-12.3) != -12.3)
|
||||
throw new RuntimeException("it failed");
|
||||
|
||||
T_NestedOuterTemplateDouble tn = new T_NestedOuterTemplateDouble();
|
||||
if (tn.hohum(-12.3) != -12.3)
|
||||
throw new RuntimeException("it failed");
|
||||
}
|
||||
}
|
||||
|
||||
39
Examples/test-suite/java/template_nested_typemaps_runme.java
Normal file
39
Examples/test-suite/java/template_nested_typemaps_runme.java
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import template_nested_typemaps.*;
|
||||
|
||||
public class template_nested_typemaps_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_nested_typemaps");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
BreezeString b = new BreezeString();
|
||||
{
|
||||
int v = 88;
|
||||
short vTypemap = -99;
|
||||
if (b.methodInt1(v) != v) throw new RuntimeException("failed");
|
||||
if (b.methodInt2(v) != vTypemap) throw new RuntimeException("failed");
|
||||
|
||||
if (template_nested_typemaps.globalInt1(v) != v) throw new RuntimeException("failed");
|
||||
if (template_nested_typemaps.globalInt2(v) != v) throw new RuntimeException("failed");
|
||||
if (template_nested_typemaps.globalInt3(v) != vTypemap) throw new RuntimeException("failed");
|
||||
}
|
||||
|
||||
{
|
||||
short v = 88;
|
||||
short vTypemap = -77;
|
||||
if (b.methodShort1(v) != v) throw new RuntimeException("failed");
|
||||
if (b.methodShort2(v) != vTypemap) throw new RuntimeException("failed");
|
||||
|
||||
if (template_nested_typemaps.globalShort1(v) != v) throw new RuntimeException("failed");
|
||||
if (template_nested_typemaps.globalShort2(v) != v) throw new RuntimeException("failed");
|
||||
if (template_nested_typemaps.globalShort3(v) != vTypemap) throw new RuntimeException("failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
import template_partial_specialization.*;
|
||||
|
||||
public class template_partial_specialization_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_partial_specialization");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
// One parameter tests
|
||||
new A().a();
|
||||
new B().b();
|
||||
new C().c();
|
||||
new D().d();
|
||||
new E().e();
|
||||
|
||||
new F().f();
|
||||
new G().g();
|
||||
new H().h();
|
||||
|
||||
new I().i();
|
||||
new J().j();
|
||||
new K().k();
|
||||
new L().l();
|
||||
|
||||
new BB().b();
|
||||
new BBB().b();
|
||||
new BBBB().b();
|
||||
new BBBBB().b();
|
||||
|
||||
new B1().b();
|
||||
new B2().b();
|
||||
new B3().b();
|
||||
new B4().b();
|
||||
|
||||
// Two parameter tests
|
||||
new A_().a();
|
||||
new B_().b();
|
||||
new C_().c();
|
||||
new D_().d();
|
||||
new E_().e();
|
||||
new F_().f();
|
||||
new G_().g();
|
||||
|
||||
new C1_().c();
|
||||
new C2_().c();
|
||||
new C3_().c();
|
||||
new C4_().c();
|
||||
new B1_().b();
|
||||
new E1_().e();
|
||||
new E2_().e();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
import template_partial_specialization_typedef.*;
|
||||
|
||||
public class template_partial_specialization_typedef_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_partial_specialization_typedef");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
// One parameter tests
|
||||
new A().a();
|
||||
new B().b();
|
||||
new C().c();
|
||||
new D().d();
|
||||
new E().e();
|
||||
|
||||
new F().f();
|
||||
new G().g();
|
||||
new H().h();
|
||||
|
||||
new I().i();
|
||||
new J().j();
|
||||
new K().k();
|
||||
new L().l();
|
||||
|
||||
new BB().b();
|
||||
new BBB().b();
|
||||
new BBBB().b();
|
||||
new BBBBB().b();
|
||||
|
||||
new B1().b();
|
||||
new B2().b();
|
||||
new B3().b();
|
||||
new B4().b();
|
||||
|
||||
// Two parameter tests
|
||||
new A_().a();
|
||||
new B_().b();
|
||||
new C_().c();
|
||||
new D_().d();
|
||||
new E_().e();
|
||||
new F_().f();
|
||||
new G_().g();
|
||||
|
||||
new C1_().c();
|
||||
new C2_().c();
|
||||
new C3_().c();
|
||||
new C4_().c();
|
||||
new B1_().b();
|
||||
new E1_().e();
|
||||
new E2_().e();
|
||||
}
|
||||
}
|
||||
|
||||
25
Examples/test-suite/java/wallkw_runme.java
Normal file
25
Examples/test-suite/java/wallkw_runme.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
import wallkw.*;
|
||||
|
||||
public class wallkw_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("wallkw");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
if (!wallkw.c_clone().equals("clone"))
|
||||
throw new RuntimeException("clone_c keyword fail");
|
||||
if (!wallkw._delegate().equals("delegate"))
|
||||
throw new RuntimeException("delegate keyword fail");
|
||||
if (!wallkw._pass().equals("pass"))
|
||||
throw new RuntimeException("pass keyword fail");
|
||||
if (!wallkw.C_alias().equals("alias"))
|
||||
throw new RuntimeException("alias keyword fail");
|
||||
}
|
||||
}
|
||||
|
|
@ -122,3 +122,11 @@ struct JObjectTest {
|
|||
|
||||
%}
|
||||
|
||||
%javaexception("Exception") etest "$action"
|
||||
%inline %{
|
||||
struct JavaExceptionTest {
|
||||
virtual ~JavaExceptionTest() {}
|
||||
virtual void etest() {}
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
%inline %{
|
||||
|
||||
jboolean jnifunc(jboolean in) { return in; }
|
||||
jboolean jnifunc_bool(jboolean in) { return in; } /* some JVM implementations won't allow overloading of the jboolean type with some of the others on the c++ level */
|
||||
jchar jnifunc(jchar in) { return in; }
|
||||
jbyte jnifunc(jbyte in) { return in; }
|
||||
jshort jnifunc(jshort in) { return in; }
|
||||
|
|
|
|||
|
|
@ -42,12 +42,16 @@ short full_of_exceptions(int num) {
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
void throw_spec_function(int value) throw (int) { throw (int)0; }
|
||||
bool throw_spec_function(int value) throw (int) { throw (int)0; }
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
%}
|
||||
|
||||
%catches(int) catches_function(int value);
|
||||
%inline %{
|
||||
bool catches_function(int value) { throw (int)0; }
|
||||
%}
|
||||
|
||||
// Check newfree typemap throws attribute
|
||||
%newobject makeTestClass;
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ code is not functioning properly it will fail to compile.
|
|||
%typemap(in) Animal ()
|
||||
{
|
||||
void *space_needed = malloc(HEIGHT_$1_lextype * WIDTH_$1_lextype);
|
||||
$1 = space_needed;
|
||||
$1 = ($1_ltype)space_needed;
|
||||
}
|
||||
|
||||
%typemap(in) Animal[2] ()
|
||||
{
|
||||
void *space_needed = malloc(2 * HEIGHT_$1_lextype * WIDTH_$1_lextype);
|
||||
$1 = space_needed;
|
||||
$1 = ($1_ltype)space_needed;
|
||||
}
|
||||
|
||||
%inline %{
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
%cdata(int);
|
||||
%cdata(double);
|
||||
|
||||
|
||||
void *malloc(size_t size);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
%newobject Geometry::clone;
|
||||
%factory(Geometry *Geometry::create, Point, Circle);
|
||||
%factory(Geometry *Geometry::clone, Point, Circle);
|
||||
#ifdef SWIGPHP
|
||||
%rename(clone_) clone;
|
||||
#endif
|
||||
%factory(Geometry *Point::clone, Point, Circle);
|
||||
%factory(Geometry *Circle::clone, Point, Circle);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,7 @@
|
|||
%module li_math
|
||||
#ifdef SWIGPHP
|
||||
// PHP already provides these functions with the same names, so just kill that
|
||||
// warning.
|
||||
%warnfilter(SWIGWARN_PARSE_KEYWORD);
|
||||
#endif
|
||||
%include math.i
|
||||
|
|
|
|||
52
Examples/test-suite/li_reference.i
Normal file
52
Examples/test-suite/li_reference.i
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
%module li_reference
|
||||
|
||||
%include "reference.i"
|
||||
|
||||
%inline %{
|
||||
double FrVal;
|
||||
double ToVal;
|
||||
void PDouble(double *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
|
||||
void RDouble(double &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = FrVal + t; }
|
||||
void PFloat(float *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = (float)(FrVal + t); }
|
||||
void RFloat(float &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = (float)(FrVal + t); }
|
||||
void PInt(int *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = (int)(FrVal + t); }
|
||||
void RInt(int &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = (int)(FrVal + t); }
|
||||
void PShort(short *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = (short)(FrVal + t); }
|
||||
void RShort(short &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = (short)(FrVal + t); }
|
||||
void PLong(long *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = (long)(FrVal + t); }
|
||||
void RLong(long &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = (long)(FrVal + t); }
|
||||
void PUInt(unsigned int *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = (unsigned int)(FrVal + t); }
|
||||
void RUInt(unsigned int &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = (unsigned int)(FrVal + t); }
|
||||
void PUShort(unsigned short *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = (unsigned short)(FrVal + t); }
|
||||
void RUShort(unsigned short &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = (unsigned short)(FrVal + t); }
|
||||
void PULong(unsigned long *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = (unsigned long)(FrVal + t); }
|
||||
void RULong(unsigned long &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = (unsigned long)(FrVal + t); }
|
||||
void PUChar(unsigned char *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = (unsigned char)(FrVal + t); }
|
||||
void RUChar(unsigned char &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = (unsigned char)(FrVal + t); }
|
||||
void PChar(signed char *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = (signed char)(FrVal + t); }
|
||||
void RChar(signed char &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = (signed char)(FrVal + t); }
|
||||
void PBool(bool *REFERENCE, int t = 0)
|
||||
{ ToVal = *REFERENCE; *REFERENCE = (FrVal + t) ? true : false; }
|
||||
void RBool(bool &REFERENCE, int t = 0)
|
||||
{ ToVal = REFERENCE; REFERENCE = (FrVal + t) ? true : false; }
|
||||
%}
|
||||
15
Examples/test-suite/li_std_combinations.i
Normal file
15
Examples/test-suite/li_std_combinations.i
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
%module li_std_combinations
|
||||
|
||||
%include <std_vector.i>
|
||||
%include <std_string.i>
|
||||
%include <std_pair.i>
|
||||
|
||||
%template(VectorInt) std::vector<int>;
|
||||
%template(VectorString) std::vector<std::string>;
|
||||
%template(PairIntString) std::pair<int, std::string>;
|
||||
|
||||
%template(VectorPairIntString) std::vector< std::pair<int, std::string> >;
|
||||
%template(PairIntVectorString) std::pair< int, std::vector<std::string> >;
|
||||
|
||||
%template(VectorVectorString) std::vector< std::vector<std::string> >;
|
||||
%template(PairIntPairIntString) std::pair< int, std::pair<int, std::string> >;
|
||||
|
|
@ -46,18 +46,6 @@ struct Struct {
|
|||
|
||||
%}
|
||||
|
||||
#if defined(SWIGCSHARP)
|
||||
|
||||
// Specialize some more non-default map types
|
||||
SWIG_STD_MAP_SPECIALIZED(int, int *, int, SWIGTYPE_p_int)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, const int *, int, SWIGTYPE_p_int)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(int, Struct)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, Struct *, int, Struct)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, const Struct *, int, Struct)
|
||||
SWIG_STD_MAP_SPECIALIZED(Struct *, int, Struct, int)
|
||||
|
||||
#endif
|
||||
|
||||
//#if !defined(SWIGR)
|
||||
|
||||
// Test out some maps with pointer types
|
||||
|
|
|
|||
|
|
@ -75,12 +75,7 @@ const std::vector<const Struct *> & vecstructconstptr(const std::vector<const St
|
|||
%}
|
||||
|
||||
#if defined(SWIGCSHARP)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(Struct, Struct *)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(Struct, const Struct *)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(SWIGTYPE_p_int, int *)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(SWIGTYPE_p_int, const int *)
|
||||
|
||||
// Also test non-specialized versions
|
||||
// Also test const and non-const pointers, but not strictly necessary since std::vector was enhanced in swig-1.3.40
|
||||
%template(StructurePtrVector) std::vector<Structure *>;
|
||||
%template(StructureConstPtrVector) std::vector<const Structure *>;
|
||||
#endif
|
||||
|
|
@ -93,10 +88,6 @@ SWIG_STD_VECTOR_SPECIALIZE(SWIGTYPE_p_int, const int *)
|
|||
%template(StructPtrVector) std::vector<Struct *>;
|
||||
%template(StructConstPtrVector) std::vector<const Struct *>;
|
||||
|
||||
#if defined(SWIGCSHARP)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(MyClass, MyClass *)
|
||||
#endif
|
||||
|
||||
#if !defined(SWIGTCL)
|
||||
%inline {
|
||||
struct MyClass {};
|
||||
|
|
|
|||
|
|
@ -125,15 +125,16 @@ std::vector<std::string> vecStr(std::vector<std::string> v) {
|
|||
|
||||
%inline %{
|
||||
int *makeIntPtr(int v) { return new int(v); }
|
||||
const short *makeConstShortPtr(int v) { return new short(v); }
|
||||
double *makeDoublePtr(double v) { return new double(v); }
|
||||
int extractInt(int *p) { return *p; }
|
||||
short extractConstShort(const short *p) { return *p; }
|
||||
%}
|
||||
|
||||
%template(pyvector) std::vector<swig::SwigPtr_PyObject>;
|
||||
|
||||
namespace std {
|
||||
%template(ConstShortVector) vector<const short *>;
|
||||
// %template(ConstIntVector) vector<const int *>; // interferes with vector<int *>... see new testcase li_std_vector_ptr
|
||||
%template(ConstShortPtrVector) vector<const short *>;
|
||||
}
|
||||
|
||||
%inline %{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// Bug 2359417
|
||||
%module li_std_vector_ptr
|
||||
|
||||
%include "std_vector.i"
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ include $(srcdir)/../common.mk
|
|||
# Overridden variables here
|
||||
LIBS = -L.
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
@ -43,9 +46,9 @@ LIBS = -L.
|
|||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.lua appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(LUA) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(LUA) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
||||
# Clean: (does nothing, we dont generate extra lua code)
|
||||
%.clean:
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ require("import") -- the import fn
|
|||
import("overload_template_fast") -- import code
|
||||
for k,v in pairs(overload_template_fast) do _G[k]=v end -- move to global
|
||||
|
||||
-- lua has only one numeric type, so max(int,int) and max(double,double) are the same
|
||||
-- lua has only one numeric type, so maximum(int,int) and maximum(double,double) are the same
|
||||
-- whichever one was wrapper first will be used (which is int)
|
||||
|
||||
f = foo()
|
||||
|
||||
a = max(3,4)
|
||||
a = maximum(3,4)
|
||||
|
||||
-- mix 1
|
||||
assert(mix1("hi") == 101)
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ require("import") -- the import fn
|
|||
import("overload_template") -- import code
|
||||
for k,v in pairs(overload_template) do _G[k]=v end -- move to global
|
||||
|
||||
-- lua has only one numeric type, so max(int,int) and max(double,double) are the same
|
||||
-- lua has only one numeric type, so maximum(int,int) and maximum(double,double) are the same
|
||||
-- whichever one was wrapper first will be used (which is int)
|
||||
|
||||
f = foo()
|
||||
|
||||
a = max(3,4)
|
||||
a = maximum(3,4)
|
||||
|
||||
-- mix 1
|
||||
assert(mix1("hi") == 101)
|
||||
|
|
|
|||
33
Examples/test-suite/memberin_extend.i
Normal file
33
Examples/test-suite/memberin_extend.i
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
%module memberin_extend
|
||||
|
||||
// Tests memberin typemap is not used for %extend.
|
||||
// The test extends the struct with a pseudo member variable
|
||||
|
||||
%inline %{
|
||||
#include <string>
|
||||
struct ExtendMe {
|
||||
};
|
||||
%}
|
||||
|
||||
%{
|
||||
#include <map>
|
||||
std::map<ExtendMe*, char *> ExtendMeStringMap;
|
||||
void ExtendMe_thing_set(ExtendMe *self, const char *val) {
|
||||
char *old_val = ExtendMeStringMap[self];
|
||||
delete [] old_val;
|
||||
if (val) {
|
||||
ExtendMeStringMap[self] = new char[strlen(val)+1];
|
||||
strcpy(ExtendMeStringMap[self], val);
|
||||
} else {
|
||||
ExtendMeStringMap[self] = 0;
|
||||
}
|
||||
}
|
||||
char * ExtendMe_thing_get(ExtendMe *self) {
|
||||
return ExtendMeStringMap[self];
|
||||
}
|
||||
%}
|
||||
|
||||
%extend ExtendMe {
|
||||
char *thing;
|
||||
}
|
||||
|
||||
38
Examples/test-suite/memberin_extend_c.i
Normal file
38
Examples/test-suite/memberin_extend_c.i
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
%module memberin_extend_c
|
||||
|
||||
/* Example from the Manual, section 5.5.6: "Adding member functions to C structures" */
|
||||
|
||||
%{
|
||||
typedef struct {
|
||||
char name[50];
|
||||
} Person;
|
||||
%}
|
||||
|
||||
typedef struct {
|
||||
%extend {
|
||||
char name[50];
|
||||
}
|
||||
} Person;
|
||||
|
||||
%{
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
void make_upper(char *name) {
|
||||
char *c;
|
||||
for (c = name; *c; ++c)
|
||||
*c = (char)toupper((int)*c);
|
||||
}
|
||||
|
||||
/* Specific implementation of set/get functions forcing capitalization */
|
||||
|
||||
char *Person_name_get(Person *p) {
|
||||
make_upper(p->name);
|
||||
return p->name;
|
||||
}
|
||||
|
||||
void Person_name_set(Person *p, char *val) {
|
||||
strncpy(p->name,val,50);
|
||||
make_upper(p->name);
|
||||
}
|
||||
%}
|
||||
|
|
@ -14,6 +14,9 @@ include $(srcdir)/../common.mk
|
|||
# Overridden variables here
|
||||
# none!
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
@ -33,9 +36,9 @@ include $(srcdir)/../common.mk
|
|||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.scm appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(MZSCHEME) -r $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(MZSCHEME) -r $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
||||
# Clean
|
||||
%.clean:
|
||||
|
|
|
|||
|
|
@ -35,7 +35,9 @@ namespace std
|
|||
{
|
||||
typedef complex None;
|
||||
|
||||
#ifndef SWIGPHP // clone() *is* an invalid method name in PHP.
|
||||
A* clone(int) { return NULL; }
|
||||
#endif
|
||||
|
||||
virtual ~A() {}
|
||||
virtual int func() = 0;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
%module namespace_class
|
||||
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Ala::Ola;
|
||||
|
||||
%inline %{
|
||||
template<class T> void foobar(T t) {}
|
||||
namespace test {
|
||||
|
|
@ -210,7 +212,6 @@ namespace a
|
|||
|
||||
%}
|
||||
|
||||
#pragma SWIG nowarn=SWIGWARN_PARSE_NESTED_CLASS
|
||||
// %copyctor doesn't work with nested class workaround
|
||||
%nocopyctor;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
%module namespace_union
|
||||
|
||||
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
|
||||
|
||||
%inline %{
|
||||
namespace SpatialIndex
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,6 +12,27 @@ struct TestStruct {
|
|||
int a;
|
||||
};
|
||||
|
||||
struct OuterStructNamed {
|
||||
struct InnerStructNamed {
|
||||
double dd;
|
||||
} inner_struct_named;
|
||||
union InnerUnionNamed {
|
||||
double ee;
|
||||
int ff;
|
||||
} inner_union_named;
|
||||
};
|
||||
|
||||
struct OuterStructUnnamed {
|
||||
struct {
|
||||
double xx;
|
||||
} inner_struct_unnamed;
|
||||
union {
|
||||
double yy;
|
||||
int zz;
|
||||
} inner_union_unnamed;
|
||||
};
|
||||
|
||||
|
||||
typedef struct OuterStruct {
|
||||
union {
|
||||
|
||||
|
|
|
|||
206
Examples/test-suite/nested_class.i
Normal file
206
Examples/test-suite/nested_class.i
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
%module nested_class
|
||||
|
||||
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct1;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass1;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion1;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass2;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct2;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion2;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass4Typedef;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct4Typedef;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion4Typedef;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass5;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct5;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion5;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultiple;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleDerived;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleAnonTypedef1;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleNamedTypedef;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerSameName;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer2::IgnoreMe;
|
||||
|
||||
%inline %{
|
||||
struct Outer {
|
||||
typedef int Integer;
|
||||
///////////////////////////////////////////
|
||||
struct InnerStruct1 {
|
||||
Integer x;
|
||||
};
|
||||
|
||||
class InnerClass1 {
|
||||
public:
|
||||
Integer x;
|
||||
};
|
||||
|
||||
union InnerUnion1 {
|
||||
Integer x;
|
||||
double y;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////
|
||||
class {
|
||||
public:
|
||||
Integer a;
|
||||
};
|
||||
|
||||
struct {
|
||||
Integer b;
|
||||
};
|
||||
|
||||
union {
|
||||
Integer c;
|
||||
double d;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////
|
||||
class InnerClass2 {
|
||||
public:
|
||||
Integer x;
|
||||
} InnerClass2Instance;
|
||||
|
||||
struct InnerStruct2 {
|
||||
Integer x;
|
||||
} InnerStruct2Instance;
|
||||
|
||||
union InnerUnion2 {
|
||||
Integer x;
|
||||
double y;
|
||||
} InnerUnion2Instance;
|
||||
|
||||
///////////////////////////////////////////
|
||||
class {
|
||||
public:
|
||||
Integer x;
|
||||
} InnerClass3Instance;
|
||||
|
||||
struct {
|
||||
Integer x;
|
||||
} InnerStruct3Instance;
|
||||
|
||||
union {
|
||||
Integer x;
|
||||
double y;
|
||||
} InnerUnion3Instance;
|
||||
|
||||
///////////////////////////////////////////
|
||||
typedef class {
|
||||
public:
|
||||
Integer x;
|
||||
} InnerClass4Typedef;
|
||||
|
||||
typedef struct {
|
||||
Integer x;
|
||||
} InnerStruct4Typedef;
|
||||
|
||||
typedef union {
|
||||
Integer x;
|
||||
double y;
|
||||
} InnerUnion4Typedef;
|
||||
|
||||
///////////////////////////////////////////
|
||||
typedef class InnerClass5 {
|
||||
public:
|
||||
Integer x;
|
||||
} InnerClass5Typedef;
|
||||
|
||||
typedef struct InnerStruct5 {
|
||||
Integer x;
|
||||
} InnerStruct5Typedef;
|
||||
|
||||
typedef union InnerUnion5 {
|
||||
Integer x;
|
||||
double y;
|
||||
} InnerUnion5Typedef;
|
||||
|
||||
// bug #909387 - inner declared types are treated as forward declarations
|
||||
InnerStruct1* makeInnerStruct1() { return 0; }
|
||||
InnerClass1* makeInnerClass1() { return 0; }
|
||||
InnerUnion1* makeInnerUnion1() { return 0; }
|
||||
|
||||
InnerStruct2* makeInnerStruct2() { return 0; }
|
||||
InnerClass2* makeInnerClass2() { return 0; }
|
||||
InnerUnion2* makeInnerUnion2() { return 0; }
|
||||
|
||||
InnerStruct4Typedef* makeInnerStruct4Typedef() { return 0; }
|
||||
InnerClass4Typedef* makeInnerClass4Typedef() { return 0; }
|
||||
InnerUnion4Typedef* makeInnerUnion4Typedef() { return 0; }
|
||||
|
||||
InnerStruct5* makeInnerStruct5() { return 0; }
|
||||
InnerClass5* makeInnerClass5() { return 0; }
|
||||
InnerUnion5* makeInnerUnion5() { return 0; }
|
||||
|
||||
InnerStruct5Typedef* makeInnerStruct5Typedef() { return 0; }
|
||||
InnerClass5Typedef* makeInnerClass5Typedef() { return 0; }
|
||||
InnerUnion5Typedef* makeInnerUnion5Typedef() { return 0; }
|
||||
|
||||
///////////////////////////////////////////
|
||||
struct InnerMultiple {
|
||||
Integer x;
|
||||
} MultipleInstance1, MultipleInstance2, *MultipleInstance3, MultipleInstance4[2];
|
||||
|
||||
struct InnerMultipleDerived : public InnerMultiple {
|
||||
Integer xx;
|
||||
} MultipleDerivedInstance1, MultipleDerivedInstance2, *MultipleDerivedInstance3, MultipleDerivedInstance4[2];
|
||||
|
||||
struct {
|
||||
Integer x;
|
||||
} MultipleInstanceAnon1, MultipleInstanceAnon2, *MultipleInstanceAnon3, MultipleInstanceAnon4[2];
|
||||
|
||||
struct : public InnerMultiple {
|
||||
Integer xx;
|
||||
} MultipleInstanceAnonDerived1, MultipleInstanceAnonDerived2, *MultipleInstanceAnonDerived3, MultipleInstanceAnonDerived4[2];
|
||||
|
||||
struct : public InnerMultiple {
|
||||
Integer xx;
|
||||
};
|
||||
|
||||
class : public InnerMultiple {
|
||||
public:
|
||||
Integer yy;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////
|
||||
typedef struct {
|
||||
Integer x;
|
||||
} InnerMultipleAnonTypedef1, InnerMultipleAnonTypedef2, *InnerMultipleAnonTypedef3;
|
||||
|
||||
InnerMultipleAnonTypedef1* makeInnerMultipleAnonTypedef1() { return 0; }
|
||||
InnerMultipleAnonTypedef2* makeInnerMultipleAnonTypedef2() { return 0; }
|
||||
InnerMultipleAnonTypedef3* makeInnerMultipleAnonTypedef3() { return 0; }
|
||||
|
||||
typedef struct InnerMultipleNamedTypedef {
|
||||
Integer x;
|
||||
} InnerMultipleNamedTypedef1, InnerMultipleNamedTypedef2, *InnerMultipleNamedTypedef3;
|
||||
|
||||
InnerMultipleNamedTypedef* makeInnerMultipleNamedTypedef() { return 0; }
|
||||
InnerMultipleNamedTypedef1* makeInnerMultipleNamedTypedef1() { return 0; }
|
||||
InnerMultipleNamedTypedef2* makeInnerMultipleNamedTypedef2() { return 0; }
|
||||
InnerMultipleNamedTypedef3* makeInnerMultipleNamedTypedef3() { return 0; }
|
||||
|
||||
///////////////////////////////////////////
|
||||
typedef struct InnerSameName {
|
||||
Integer x;
|
||||
} InnerSameName;
|
||||
|
||||
InnerSameName* makeInnerSameName() { return 0; }
|
||||
};
|
||||
%}
|
||||
|
||||
// Ignore nested struct instance
|
||||
%ignore Outer2::IgnoreMeInstance;
|
||||
%{
|
||||
struct Outer2 {
|
||||
struct IgnoreMe {
|
||||
int xx;
|
||||
};
|
||||
};
|
||||
%}
|
||||
|
||||
struct Outer2 {
|
||||
struct IgnoreMe {
|
||||
int xx;
|
||||
} IgnoreMeInstance;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1,23 +1,25 @@
|
|||
%module nested_comment
|
||||
|
||||
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
|
||||
|
||||
// this example shows a problem with 'dump_nested' (parser.y).
|
||||
|
||||
// bug #949654
|
||||
%inline %{
|
||||
typedef struct s1 {
|
||||
union {
|
||||
int fsc; /* genie structure hiding - Conductor
|
||||
*/
|
||||
int fso; /* genie structure hiding - FSOptions
|
||||
*/
|
||||
struct {
|
||||
double *vals;
|
||||
int size;
|
||||
} vector_val; /* matrix values are mainly used
|
||||
in rlgc models */
|
||||
char *name;
|
||||
} n ;
|
||||
} s2;
|
||||
typedef struct s1 {
|
||||
union {
|
||||
int fsc; /* genie structure hiding - Conductor
|
||||
*/
|
||||
int fso; /* genie structure hiding - FSOptions
|
||||
*/
|
||||
struct {
|
||||
double *vals;
|
||||
int size;
|
||||
} vector_val; /* matrix values are mainly used
|
||||
in rlgc models */
|
||||
char *name;
|
||||
} n ;
|
||||
} s2;
|
||||
%}
|
||||
|
||||
// comment in nested struct
|
||||
|
|
@ -27,7 +29,7 @@ struct a
|
|||
struct {
|
||||
/*struct*/
|
||||
struct {
|
||||
int b;
|
||||
int b; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
|
||||
} c;
|
||||
} d;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,21 +2,26 @@
|
|||
|
||||
// bug #491476
|
||||
%inline %{
|
||||
struct {
|
||||
struct {
|
||||
int a;
|
||||
} a, b;
|
||||
} a;
|
||||
struct Outer {
|
||||
struct {
|
||||
int val;
|
||||
} inner1, inner2, *inner3, inner4[1];
|
||||
struct Named {
|
||||
int val;
|
||||
} inside1, inside2, *inside3, inside4[1];
|
||||
} outer;
|
||||
|
||||
%}
|
||||
|
||||
// bug #909387
|
||||
%inline %{
|
||||
struct foo {
|
||||
struct happy; // no warning
|
||||
struct sad { int x; }; // warning
|
||||
happy *good(); // produces good code
|
||||
sad *bad(); // produces bad code
|
||||
};
|
||||
void setValues(struct Outer *outer, int val) {
|
||||
outer->inner1.val = val;
|
||||
outer->inner2.val = val * 2;
|
||||
outer->inner3 = &outer->inner2;
|
||||
outer->inner4[0].val = val * 4;
|
||||
|
||||
val = val * 10;
|
||||
outer->inside1.val = val;
|
||||
outer->inside2.val = val * 2;
|
||||
outer->inside3 = &outer->inside2;
|
||||
outer->inside4[0].val = val * 4;
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
|||
38
Examples/test-suite/nested_workaround.i
Normal file
38
Examples/test-suite/nested_workaround.i
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
%module nested_workaround
|
||||
// Similar to "Nested classes" documentation example.
|
||||
|
||||
class Inner {
|
||||
int val;
|
||||
public:
|
||||
Inner(int v = 0) : val(v) {}
|
||||
void setValue(int v) { val = v; }
|
||||
int getValue() const { return val; }
|
||||
};
|
||||
%nestedworkaround Outer::Inner;
|
||||
|
||||
%inline %{
|
||||
class Outer {
|
||||
public:
|
||||
class Inner {
|
||||
int val;
|
||||
public:
|
||||
Inner(int v = 0) : val(v) {}
|
||||
void setValue(int v) { val = v; }
|
||||
int getValue() const { return val; }
|
||||
};
|
||||
Inner createInner(int v) const { return Inner(v); }
|
||||
int getInnerValue(const Inner& i) const { return i.getValue(); }
|
||||
Inner doubleInnerValue(Inner inner) {
|
||||
inner.setValue(inner.getValue() * 2);
|
||||
return inner;
|
||||
}
|
||||
};
|
||||
%}
|
||||
|
||||
// We've fooled SWIG into thinking that Inner is a global class, so now we need
|
||||
// to trick the C++ compiler into understanding this apparent global type.
|
||||
%{
|
||||
typedef Outer::Inner Inner;
|
||||
%}
|
||||
|
||||
|
||||
|
|
@ -14,13 +14,13 @@ C_TEST_CASES =
|
|||
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) -a \
|
||||
-f $(top_srcdir)/Examples/test-suite/$*.list ] ; then ( \
|
||||
-f $(top_srcdir)/Examples/test-suite/$*.list ] ; then \
|
||||
$(COMPILETOOL) $(OCAMLC) -c $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
$(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme `cat $(top_srcdir)/Examples/test-suite/$(*).list | sed -e 's/\(.*\)/\1_wrap.o \1.cmo/g'`&& $(RUNTOOL) ./runme) ; \
|
||||
elif [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
$(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme `cat $(top_srcdir)/Examples/test-suite/$(*).list | sed -e 's/\(.*\)/\1_wrap.o \1.cmo/g'`&& $(RUNTOOL) ./runme; \
|
||||
elif [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
$(COMPILETOOL) $(OCAMLC) -c $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
$(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme $(srcdir)/$(*).cmo $(srcdir)/$(*)_runme.cmo $(srcdir)/$(*)_wrap.o && \
|
||||
$(RUNTOOL) ./runme) ; \
|
||||
$(RUNTOOL) ./runme; \
|
||||
fi ;
|
||||
|
||||
check_quant:
|
||||
|
|
@ -44,6 +44,9 @@ include $(srcdir)/../common.mk
|
|||
# Overridden variables here
|
||||
# none!
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
echo $@ >> testing
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ CPP_TEST_CASES += \
|
|||
CPP_TEST_BROKEN += \
|
||||
implicittest \
|
||||
li_implicit \
|
||||
li_std_map \
|
||||
li_std_set \
|
||||
li_std_stream
|
||||
|
||||
|
|
@ -34,6 +33,9 @@ include $(srcdir)/../common.mk
|
|||
# Overridden variables here
|
||||
LIBS = -L.
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
|
|
@ -53,9 +55,9 @@ LIBS = -L.
|
|||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.m appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVEPATH=$(srcdir):OCTAVEPATH $(RUNTOOL) $(OCTAVE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
|
||||
fi;
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVEPATH=$(srcdir):OCTAVEPATH $(RUNTOOL) $(OCTAVE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
|
||||
fi
|
||||
|
||||
# Clean: remove the generated .m file
|
||||
%.clean:
|
||||
|
|
|
|||
|
|
@ -1,57 +0,0 @@
|
|||
director_exception
|
||||
|
||||
MyFoo=@() subclass(Foo(),
|
||||
'ping',@(self) raise(NotImplementedError("MyFoo::ping() EXCEPTION")));
|
||||
|
||||
MyFoo2=@() subclass(Foo(),
|
||||
'ping',@(self) true);
|
||||
|
||||
ok = 0;
|
||||
|
||||
a = MyFoo();
|
||||
b = launder(a);
|
||||
|
||||
try
|
||||
b.pong();
|
||||
catch
|
||||
[etype,e]=raised();
|
||||
if (etype=="NotImplementedError")
|
||||
ok=1;
|
||||
endif
|
||||
end_try_catch
|
||||
|
||||
if (!ok)
|
||||
error
|
||||
endif
|
||||
|
||||
ok = 0;
|
||||
|
||||
a = MyFoo2();
|
||||
b = launder(a);
|
||||
|
||||
try
|
||||
b.pong();
|
||||
catch
|
||||
ok = 1;
|
||||
end_try_catch
|
||||
|
||||
if (!ok)
|
||||
error
|
||||
endif
|
||||
|
||||
|
||||
try
|
||||
raise(Exception2());
|
||||
catch
|
||||
if (!strcmp(raised,"Exception2"))
|
||||
rethrow(lasterr);
|
||||
endif
|
||||
end_try_catch
|
||||
|
||||
try
|
||||
raise(Exception1());
|
||||
catch
|
||||
if (!strcmp(raised,"Exception1"))
|
||||
rethrow(lasterr);
|
||||
endif
|
||||
end_try_catch
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
director_finalizer
|
||||
|
||||
MyFoo=@() subclass(Foo(),'__del__',@delete_MyFoo);
|
||||
function delete_MyFoo(self)
|
||||
self.orStatus(2);
|
||||
try
|
||||
Foo.__del__(self);
|
||||
catch
|
||||
end_try_catch
|
||||
endfunction
|
||||
|
||||
resetStatus();
|
||||
|
||||
a = MyFoo();
|
||||
clear a;
|
||||
|
||||
if (getStatus() != 3)
|
||||
error
|
||||
endif
|
||||
|
||||
resetStatus();
|
||||
|
||||
a = MyFoo();
|
||||
launder(a);
|
||||
|
||||
if (getStatus() != 0)
|
||||
error
|
||||
endif
|
||||
|
||||
clear a;
|
||||
|
||||
if (getStatus() != 3)
|
||||
error
|
||||
endif
|
||||
|
||||
resetStatus();
|
||||
|
||||
a = MyFoo().__disown__();
|
||||
deleteFoo(a);
|
||||
|
||||
if (getStatus() != 3)
|
||||
error
|
||||
endif
|
||||
|
||||
resetStatus();
|
||||
|
||||
a = MyFoo().__disown__();
|
||||
deleteFoo(launder(a));
|
||||
|
||||
if (getStatus() != 3)
|
||||
error
|
||||
endif
|
||||
|
||||
resetStatus();
|
||||
|
||||
|
||||
|
|
@ -1 +1,2 @@
|
|||
empty
|
||||
|
||||
|
|
|
|||
|
|
@ -5,3 +5,19 @@ enums.bar2(1)
|
|||
enums.bar3(1)
|
||||
enums.bar1(1)
|
||||
|
||||
if (enums.cvar.enumInstance != 2)
|
||||
error
|
||||
endif
|
||||
|
||||
if (enums.cvar.Slap != 10)
|
||||
error
|
||||
endif
|
||||
|
||||
if (enums.cvar.My != 11)
|
||||
error
|
||||
endif
|
||||
|
||||
if (enums.cvar.Thigh != 12)
|
||||
error
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -6,40 +6,39 @@ a = A();
|
|||
try
|
||||
a.foo()
|
||||
catch
|
||||
if (!strcmp(raised(),"E1"))
|
||||
error, "bad exception order"
|
||||
if (!strcmp(lasterror.message, "error: C++ side threw an exception of type E1\n"))
|
||||
error("bad exception order")
|
||||
endif
|
||||
end_try_catch
|
||||
|
||||
try
|
||||
a.bar()
|
||||
catch
|
||||
if (!strcmp(raised(),"E2"))
|
||||
error, "bad exception order"
|
||||
if (!strcmp(lasterror.message, "error: C++ side threw an exception of type E2\n"))
|
||||
error("bad exception order")
|
||||
endif
|
||||
end_try_catch
|
||||
|
||||
try
|
||||
a.foobar()
|
||||
catch
|
||||
[t,e]=raised();
|
||||
if (!strcmp(e.args(0),"postcatch unknown"))
|
||||
error
|
||||
if (!strcmp(lasterror.message, "error: postcatch unknown (SWIG_RuntimeError)\n"))
|
||||
error("bad exception order")
|
||||
endif
|
||||
end_try_catch
|
||||
|
||||
try
|
||||
a.barfoo(1)
|
||||
catch
|
||||
if (!strcmp(raised(),"E1"))
|
||||
error, "bad exception order"
|
||||
if (!strcmp(lasterror.message, "error: C++ side threw an exception of type E1\n"))
|
||||
error("bad exception order")
|
||||
endif
|
||||
end_try_catch
|
||||
|
||||
try
|
||||
a.barfoo(2)
|
||||
catch
|
||||
if (!strcmp(raised(),"E2"))
|
||||
error, "bad exception order"
|
||||
if (!strcmp(lasterror.message, "error: C++ side threw an exception of type E2 *\n"))
|
||||
error("bad exception order")
|
||||
endif
|
||||
end_try_catch
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# This is the import runtime testcase.
|
||||
|
||||
imports_b
|
||||
imports_a
|
||||
imports_b;
|
||||
imports_a;
|
||||
|
||||
x = imports_b.B();
|
||||
x.hello();
|
||||
|
|
|
|||
|
|
@ -1,160 +1,11 @@
|
|||
li_std_vector
|
||||
|
||||
iv = IntVector(4);
|
||||
for i=0:4,
|
||||
for i=0:3,
|
||||
iv(i) = i;
|
||||
endfor
|
||||
|
||||
x = average(iv);
|
||||
y = average([1,2,3,4]);
|
||||
|
||||
a = half([10,10.5,11,11.5]);
|
||||
|
||||
dv = DoubleVector(10);
|
||||
for i=0:10,
|
||||
dv(i) = i/2.0;
|
||||
endfor
|
||||
|
||||
halve_in_place(dv);
|
||||
|
||||
|
||||
bv = BoolVector(4);
|
||||
bv(0)= 1;
|
||||
bv(1)= 0;
|
||||
bv(2)= 4;
|
||||
bv(3)= 0;
|
||||
|
||||
if (bv(0) != bv(2))
|
||||
error("bad std::vector<bool> mapping")
|
||||
if (x != 1.5)
|
||||
error("average failed");
|
||||
endif
|
||||
|
||||
b = B(5);
|
||||
va = VecA([b,None,b,b]);
|
||||
|
||||
if (va(0).f(1) != 6)
|
||||
error("bad std::vector<A*> mapping")
|
||||
endif
|
||||
|
||||
if (vecAptr(va) != 6)
|
||||
error("bad std::vector<A*> mapping")
|
||||
endif
|
||||
|
||||
b.val = 7;
|
||||
if (va(3).f(1) != 8)
|
||||
error("bad std::vector<A*> mapping")
|
||||
endif
|
||||
|
||||
|
||||
ip = PtrInt();
|
||||
ap = new_ArrInt(10);
|
||||
|
||||
ArrInt_setitem(ip,0,123);
|
||||
ArrInt_setitem(ap,2,123);
|
||||
|
||||
vi = IntPtrVector((ip,ap,None));
|
||||
if (ArrInt_getitem(vi[0],0) != ArrInt_getitem(vi[1],2))
|
||||
error("bad std::vector<int*> mapping")
|
||||
endif
|
||||
|
||||
delete_ArrInt(ap);
|
||||
|
||||
|
||||
a = halfs([10,8,4,3]);
|
||||
|
||||
v = IntVector();
|
||||
v(0:2) = [1,2];
|
||||
if (v(0) != 1 || v[1] != 2)
|
||||
error("bad setslice")
|
||||
endif
|
||||
|
||||
if (v(0:-1)(0) != 1)
|
||||
error("bad getslice")
|
||||
endif
|
||||
|
||||
if (v(0:-2).size() != 0)
|
||||
error("bad getslice")
|
||||
|
||||
v(0:1) = [2];
|
||||
if (v(0) != 2)
|
||||
error("bad setslice")
|
||||
endif
|
||||
|
||||
v(1:) = [3];
|
||||
if (v(1) != 3)
|
||||
error("bad setslice")
|
||||
endif
|
||||
|
||||
v(2:) = [3]
|
||||
if (v(2) != 3)
|
||||
error("bad setslice")
|
||||
endif
|
||||
|
||||
if (v(0:)(0) != v(0))
|
||||
error("bad getslice")
|
||||
endif
|
||||
|
||||
|
||||
v.erase(:)
|
||||
if (v.size() != 0)
|
||||
error("bad getslice")
|
||||
endif
|
||||
|
||||
v.erase(:)
|
||||
if (v.size() != 0)
|
||||
error("bad getslice")
|
||||
endif
|
||||
|
||||
|
||||
|
||||
v = vecStr({"hello ", "world"});
|
||||
if (v(0) != 'hello world')
|
||||
error,"bad std::string+std::vector"
|
||||
endif
|
||||
|
||||
|
||||
pv = pyvector({1, "hello", (1,2)});
|
||||
|
||||
if (pv(1) != "hello")
|
||||
error
|
||||
endif
|
||||
|
||||
|
||||
iv = IntVector(5);
|
||||
for i=0:5,
|
||||
iv(i) = i
|
||||
endif
|
||||
|
||||
iv(1:3) = [];
|
||||
if (iv(1) != 3)
|
||||
error
|
||||
endif
|
||||
|
||||
# Overloading checks
|
||||
if (overloaded1(iv) != "vector<int>")
|
||||
error
|
||||
endif
|
||||
|
||||
if (overloaded1(dv) != "vector<double>")
|
||||
error
|
||||
endif
|
||||
|
||||
if (overloaded2(iv) != "vector<int>")
|
||||
error
|
||||
endif
|
||||
|
||||
if (overloaded2(dv) != "vector<double>")
|
||||
error
|
||||
endif
|
||||
|
||||
if (overloaded3(iv) != "vector<int> *")
|
||||
error
|
||||
endif
|
||||
|
||||
if (overloaded3(None) != "vector<int> *")
|
||||
error
|
||||
endif
|
||||
|
||||
if (overloaded3(100) != "int")
|
||||
error
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
multi_import_a
|
||||
multi_import_b
|
||||
multi_import_a;
|
||||
multi_import_b;
|
||||
|
||||
x = multi_import_b.XXX();
|
||||
if (x.testx() != 0)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ overload_template_fast
|
|||
|
||||
f = foo();
|
||||
|
||||
a = max(3,4);
|
||||
b = max(3.4,5.2);
|
||||
a = maximum(3,4);
|
||||
b = maximum(3.4,5.2);
|
||||
|
||||
# mix 1
|
||||
if (mix1("hi") != 101)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue