director_property testcase for C# and Java
Testing std::string as director method parameter
This commit is contained in:
parent
f32a20fc2f
commit
88f1389f80
2 changed files with 105 additions and 0 deletions
51
Examples/test-suite/csharp/director_property_runme.cs
Normal file
51
Examples/test-suite/csharp/director_property_runme.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
|
||||
namespace director_propertyNamespace {
|
||||
|
||||
public class runme
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
{
|
||||
Foo a = new MyFoo();
|
||||
if (a.getA() != "") {
|
||||
throw new Exception( "Test failed" );
|
||||
}
|
||||
a.setA("Hello");
|
||||
if (a.getA() != "Hello set from MyFoo") {
|
||||
throw new Exception( "Test failed" );
|
||||
}
|
||||
a.Dispose();
|
||||
}
|
||||
|
||||
{
|
||||
Foo a_original = new MyFoo();
|
||||
Foo a = Foo.get_self(a_original);
|
||||
if (a.getA() != "") {
|
||||
throw new Exception( "Test failed" );
|
||||
}
|
||||
a.setA("Hello");
|
||||
if (a.getA() != "Hello set from MyFoo") {
|
||||
throw new Exception( "Test failed" );
|
||||
}
|
||||
a.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MyFoo : Foo
|
||||
{
|
||||
public MyFoo()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
public override void setA(string a)
|
||||
{
|
||||
base.setA(a + " set from MyFoo");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
54
Examples/test-suite/java/director_property_runme.java
Normal file
54
Examples/test-suite/java/director_property_runme.java
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
import director_property.*;
|
||||
|
||||
public class director_property_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("director_property");
|
||||
} 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[]) {
|
||||
|
||||
{
|
||||
Foo a = new director_property_MyFoo();
|
||||
if (!a.getA().equals("")) {
|
||||
throw new RuntimeException( "Test failed" );
|
||||
}
|
||||
a.setA("Hello");
|
||||
if (!a.getA().equals("Hello set from MyFoo")) {
|
||||
throw new RuntimeException( "Test failed" );
|
||||
}
|
||||
a.delete();
|
||||
}
|
||||
|
||||
{
|
||||
Foo a_original = new director_property_MyFoo();
|
||||
Foo a = Foo.get_self(a_original);
|
||||
if (!a.getA().equals("")) {
|
||||
throw new RuntimeException( "Test failed" );
|
||||
}
|
||||
a.setA("Hello");
|
||||
if (!a.getA().equals("Hello set from MyFoo")) {
|
||||
throw new RuntimeException( "Test failed" );
|
||||
}
|
||||
a.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class director_property_MyFoo extends Foo {
|
||||
public director_property_MyFoo() {
|
||||
super();
|
||||
}
|
||||
@Override
|
||||
public void setA(String a) {
|
||||
super.setA(a + " set from MyFoo");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue