Merged trunk through revision 12591
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12592 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
f759999f40
38 changed files with 521 additions and 112 deletions
|
|
@ -5,6 +5,7 @@
|
|||
LANGUAGE = csharp
|
||||
SCRIPTSUFFIX = _runme.cs
|
||||
INTERPRETER = @CSHARPCILINTERPRETER@
|
||||
INTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
|
||||
CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@"
|
||||
CSHARPCYGPATH_W = @CSHARPCYGPATH_W@
|
||||
srcdir = @srcdir@
|
||||
|
|
@ -68,13 +69,13 @@ setup = \
|
|||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
|
||||
CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
|
||||
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \
|
||||
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(INTERPRETER) $*_runme.exe; \
|
||||
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(INTERPRETER) $(INTERPRETER_FLAGS) $*_runme.exe; \
|
||||
else \
|
||||
cd $* && \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
|
||||
CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
|
||||
CSHARPSRCS='`find . -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile; \
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -405,6 +405,28 @@ public class runme {
|
|||
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");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typeint) != 10) throw new Exception("differentTypes 1 failed");
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typeboolfalse) != 0) throw new Exception("differentTypes 2 failed");
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typebooltrue) != 1) throw new Exception("differentTypes 3 failed");
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typebooltwo) != 2) throw new Exception("differentTypes 4 failed");
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typechar) != 'C') throw new Exception("differentTypes 5 failed");
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typedefaultint) != 'D') throw new Exception("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough.global_typeint;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough.global_typeboolfalse;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough.global_typebooltrue;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough.global_typebooltwo;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough.global_typechar;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough.global_typedefaultint;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -405,6 +405,28 @@ public class runme {
|
|||
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");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typeint) != 10) throw new Exception("differentTypes 1 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typeboolfalse) != 0) throw new Exception("differentTypes 2 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typebooltrue) != 1) throw new Exception("differentTypes 3 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typebooltwo) != 2) throw new Exception("differentTypes 4 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typechar) != 'C') throw new Exception("differentTypes 5 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typedefaultint) != 'D') throw new Exception("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough_simple.global_typeint;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough_simple.global_typeboolfalse;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough_simple.global_typebooltrue;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough_simple.global_typebooltwo;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough_simple.global_typechar;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_simple.global_typedefaultint;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -405,6 +405,28 @@ public class runme {
|
|||
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");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typeint).swigValue != 10) throw new Exception("differentTypes 1 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typebooltrue).swigValue != 1) throw new Exception("differentTypes 2 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typebooltwo).swigValue != 2) throw new Exception("differentTypes 3 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typeboolfalse).swigValue != 0) throw new Exception("differentTypes 4 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typechar).swigValue != (int)'C') throw new Exception("differentTypes 5 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typedefaultint).swigValue != (int)'D') throw new Exception("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough_typesafe.global_typeint;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typeboolfalse;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typebooltrue;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typebooltwo;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typechar;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typedefaultint;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
43
Examples/test-suite/csharp/friends_runme.cs
Normal file
43
Examples/test-suite/csharp/friends_runme.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using friendsNamespace;
|
||||
|
||||
public class friends_runme {
|
||||
public static void Main() {
|
||||
A a = new A(2);
|
||||
|
||||
if (friends.get_val1(a) != 2)
|
||||
throw new Exception("failed");
|
||||
if (friends.get_val2(a) != 4)
|
||||
throw new Exception("failed");
|
||||
if (friends.get_val3(a) != 6)
|
||||
throw new Exception("failed");
|
||||
|
||||
// nice overload working fine
|
||||
if (friends.get_val1(1,2,3) != 1)
|
||||
throw new Exception("failed");
|
||||
|
||||
B b = new B(3);
|
||||
|
||||
// David's case
|
||||
if (friends.mix(a,b) != 5)
|
||||
throw new Exception("failed");
|
||||
|
||||
D_d di = new D_d(2);
|
||||
D_d dd = new D_d(3.3);
|
||||
|
||||
// incredible template overloading working just fine
|
||||
if (friends.get_val1(di) != 2)
|
||||
throw new Exception("failed");
|
||||
if (friends.get_val1(dd) != 3.3)
|
||||
throw new Exception("failed");
|
||||
|
||||
friends.set(di, 4);
|
||||
friends.set(dd, 1.3);
|
||||
|
||||
if (friends.get_val1(di) != 4)
|
||||
throw new Exception("failed");
|
||||
if (friends.get_val1(dd) != 1.3)
|
||||
throw new Exception("failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -537,7 +537,6 @@ IgnoreTest::IgnoreE ignoreETest(IgnoreTest::IgnoreE n) { return n; }
|
|||
%}
|
||||
|
||||
%inline %{
|
||||
|
||||
namespace RepeatSpace {
|
||||
typedef enum
|
||||
{
|
||||
|
|
@ -550,6 +549,58 @@ typedef enum
|
|||
} repeat;
|
||||
repeat repeatTest(repeat e) { return e; }
|
||||
}
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
namespace DifferentSpace {
|
||||
enum DifferentTypes {
|
||||
typeint = 10,
|
||||
typeboolfalse = false,
|
||||
typebooltrue = true,
|
||||
typebooltwo,
|
||||
typechar = 'C',
|
||||
typedefaultint
|
||||
};
|
||||
DifferentTypes differentTypesTest(DifferentTypes n) { return n; }
|
||||
|
||||
enum {
|
||||
global_typeint = 10,
|
||||
global_typeboolfalse = false,
|
||||
global_typebooltrue = true,
|
||||
global_typebooltwo,
|
||||
global_typechar = 'C',
|
||||
global_typedefaultint
|
||||
};
|
||||
int globalDifferentTypesTest(int n) { return n; }
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
#if defined(SWIGJAVA)
|
||||
%javaconst(0);
|
||||
#elif defined(SWIGCSHARP)
|
||||
%csconst(0);
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
namespace DifferentSpace {
|
||||
enum DifferentTypesNoConst {
|
||||
typeint_noconst = 10,
|
||||
typeboolfalse_noconst = false,
|
||||
typebooltrue_noconst = true,
|
||||
typebooltwo_noconst,
|
||||
typechar_noconst = 'C',
|
||||
typedefaultint_noconst
|
||||
};
|
||||
|
||||
enum {
|
||||
global_typeint_noconst = 10,
|
||||
global_typeboolfalse_noconst = false,
|
||||
global_typebooltrue_noconst = true,
|
||||
global_typebooltwo_noconst,
|
||||
global_typechar_noconst = 'C',
|
||||
global_typedefaultint_noconst
|
||||
};
|
||||
}
|
||||
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -416,6 +416,28 @@ public class enum_thorough_proper_runme {
|
|||
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");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typeint).swigValue() != 10) throw new RuntimeException("differentTypes 1 failed");
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typeboolfalse).swigValue() != 0) throw new RuntimeException("differentTypes 2 failed");
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typebooltrue).swigValue() != 1) throw new RuntimeException("differentTypes 3 failed");
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typebooltwo).swigValue() != 2) throw new RuntimeException("differentTypes 4 failed");
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typechar).swigValue() != 'C') throw new RuntimeException("differentTypes 5 failed");
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typedefaultint).swigValue() != 'D') throw new RuntimeException("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough_proper.global_typeint;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough_proper.global_typeboolfalse;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough_proper.global_typebooltrue;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough_proper.global_typebooltwo;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough_proper.global_typechar;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_proper.global_typedefaultint;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,6 +416,28 @@ public class enum_thorough_runme {
|
|||
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");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typeint).swigValue() != 10) throw new RuntimeException("differentTypes 1 failed");
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typeboolfalse).swigValue() != 0) throw new RuntimeException("differentTypes 2 failed");
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typebooltrue).swigValue() != 1) throw new RuntimeException("differentTypes 3 failed");
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typebooltwo).swigValue() != 2) throw new RuntimeException("differentTypes 4 failed");
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typechar).swigValue() != 'C') throw new RuntimeException("differentTypes 5 failed");
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typedefaultint).swigValue() != 'D') throw new RuntimeException("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough.global_typeint;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough.global_typeboolfalse;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough.global_typebooltrue;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough.global_typebooltwo;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough.global_typechar;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough.global_typedefaultint;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,6 +416,28 @@ public class enum_thorough_simple_runme {
|
|||
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");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typeint) != 10) throw new RuntimeException("differentTypes 1 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typeboolfalse) != 0) throw new RuntimeException("differentTypes 2 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typebooltrue) != 1) throw new RuntimeException("differentTypes 3 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typebooltwo) != 2) throw new RuntimeException("differentTypes 4 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typechar) != 'C') throw new RuntimeException("differentTypes 5 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typedefaultint) != 'D') throw new RuntimeException("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough_simple.global_typeint;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough_simple.global_typeboolfalse;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough_simple.global_typebooltrue;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough_simple.global_typebooltwo;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough_simple.global_typechar;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_simple.global_typedefaultint;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,6 +416,28 @@ public class enum_thorough_typeunsafe_runme {
|
|||
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");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typeint) != 10) throw new RuntimeException("differentTypes 1 failed");
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typeboolfalse) != 0) throw new RuntimeException("differentTypes 2 failed");
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typebooltrue) != 1) throw new RuntimeException("differentTypes 3 failed");
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typebooltwo) != 2) throw new RuntimeException("differentTypes 4 failed");
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typechar) != 'C') throw new RuntimeException("differentTypes 5 failed");
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typedefaultint) != 'D') throw new RuntimeException("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough_typeunsafe.global_typeint;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough_typeunsafe.global_typeboolfalse;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough_typeunsafe.global_typebooltrue;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough_typeunsafe.global_typebooltwo;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough_typeunsafe.global_typechar;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_typeunsafe.global_typedefaultint;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
53
Examples/test-suite/java/friends_runme.java
Normal file
53
Examples/test-suite/java/friends_runme.java
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import friends.*;
|
||||
|
||||
public class friends_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("friends");
|
||||
} 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[]) throws Throwable
|
||||
{
|
||||
A a = new A(2);
|
||||
|
||||
if (friends.get_val1(a) != 2)
|
||||
throw new RuntimeException("failed");
|
||||
if (friends.get_val2(a) != 4)
|
||||
throw new RuntimeException("failed");
|
||||
if (friends.get_val3(a) != 6)
|
||||
throw new RuntimeException("failed");
|
||||
|
||||
// nice overload working fine
|
||||
if (friends.get_val1(1,2,3) != 1)
|
||||
throw new RuntimeException("failed");
|
||||
|
||||
B b = new B(3);
|
||||
|
||||
// David's case
|
||||
if (friends.mix(a,b) != 5)
|
||||
throw new RuntimeException("failed");
|
||||
|
||||
D_d di = new D_d(2);
|
||||
D_d dd = new D_d(3.3);
|
||||
|
||||
// incredible template overloading working just fine
|
||||
if (friends.get_val1(di) != 2)
|
||||
throw new RuntimeException("failed");
|
||||
if (friends.get_val1(dd) != 3.3)
|
||||
throw new RuntimeException("failed");
|
||||
|
||||
friends.set(di, 4);
|
||||
friends.set(dd, 1.3);
|
||||
|
||||
if (friends.get_val1(di) != 4)
|
||||
throw new RuntimeException("failed");
|
||||
if (friends.get_val1(dd) != 1.3)
|
||||
throw new RuntimeException("failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8,5 +8,9 @@
|
|||
bool func(A* a) {
|
||||
return !a;
|
||||
}
|
||||
|
||||
A* getnull() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
|
||||
class FooImplementation {
|
||||
public:
|
||||
int mingy() {}
|
||||
int constmingy() const {}
|
||||
static int thingy() {}
|
||||
int mingy() { return 0; }
|
||||
int constmingy() const { return 0; }
|
||||
static int thingy() { return 0; }
|
||||
static int svariable;
|
||||
static const int constsvariable;
|
||||
int normalvariable;
|
||||
|
|
|
|||
21
Examples/test-suite/tcl/null_pointer_runme.tcl
Normal file
21
Examples/test-suite/tcl/null_pointer_runme.tcl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
if [ catch { load ./null_pointer[info sharedlibextension] null_pointer} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
|
||||
set a [A]
|
||||
if {[func $a] != 0} {
|
||||
puts stderr "null_pointer test 1 failed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set null [getnull]
|
||||
if {$null != "NULL"} {
|
||||
puts stderr "null_pointer test 2 failed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if {[llength [info commands "NULL"]] != 0} {
|
||||
puts stderr "null_pointer test 3 failed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue