mirror of https://github.com/swig/swig
director string testing additions
Add test for C# based on Java example to test strings in and out. Memory cleanup for Java test.
This commit is contained in:
parent
31af3ce9bf
commit
86eaf30735
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
|
||||
namespace director_defaultNamespace {
|
||||
|
||||
public class runme
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
{
|
||||
MyFoo a = new MyFoo();
|
||||
a = new MyFoo(10);
|
||||
a.Dispose();
|
||||
}
|
||||
|
||||
{
|
||||
MyFoo a = new MyFoo();
|
||||
if (a.GetMsg() != "MyFoo-default") {
|
||||
throw new Exception( "Test 1 failed" );
|
||||
}
|
||||
if (a.GetMsg("boo") != "MyFoo-boo") {
|
||||
throw new Exception( "Test 2 failed" );
|
||||
}
|
||||
a.Dispose();
|
||||
}
|
||||
|
||||
{
|
||||
Foo b = new Foo();
|
||||
if (b.GetMsg() != "Foo-default") {
|
||||
throw new Exception( "Test 1 failed" );
|
||||
}
|
||||
if (b.GetMsg("boo") != "Foo-boo") {
|
||||
throw new Exception( "Test 2 failed" );
|
||||
}
|
||||
b.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MyFoo : Foo
|
||||
{
|
||||
public MyFoo()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
public MyFoo(int i)
|
||||
: base(i)
|
||||
{
|
||||
}
|
||||
|
||||
public override string Msg(string msg)
|
||||
{
|
||||
return "MyFoo-" + msg;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,22 +16,29 @@ public class director_default_runme {
|
|||
{
|
||||
director_default_MyFoo a = new director_default_MyFoo();
|
||||
a = new director_default_MyFoo(10);
|
||||
a.delete();
|
||||
}
|
||||
|
||||
director_default_MyFoo a = new director_default_MyFoo();
|
||||
if (!a.GetMsg().equals("director_default_MyFoo-default")) {
|
||||
throw new RuntimeException ( "Test 1 failed" );
|
||||
}
|
||||
if (!a.GetMsg("boo").equals("director_default_MyFoo-boo")) {
|
||||
throw new RuntimeException ( "Test 2 failed" );
|
||||
{
|
||||
director_default_MyFoo a = new director_default_MyFoo();
|
||||
if (!a.GetMsg().equals("director_default_MyFoo-default")) {
|
||||
throw new RuntimeException ( "Test 1 failed" );
|
||||
}
|
||||
if (!a.GetMsg("boo").equals("director_default_MyFoo-boo")) {
|
||||
throw new RuntimeException ( "Test 2 failed" );
|
||||
}
|
||||
a.delete();
|
||||
}
|
||||
|
||||
Foo b = new Foo();
|
||||
if (!b.GetMsg().equals("Foo-default")) {
|
||||
throw new RuntimeException ( "Test 1 failed" );
|
||||
}
|
||||
if (!b.GetMsg("boo").equals("Foo-boo")) {
|
||||
throw new RuntimeException ( "Test 2 failed" );
|
||||
{
|
||||
Foo b = new Foo();
|
||||
if (!b.GetMsg().equals("Foo-default")) {
|
||||
throw new RuntimeException ( "Test 1 failed" );
|
||||
}
|
||||
if (!b.GetMsg("boo").equals("Foo-boo")) {
|
||||
throw new RuntimeException ( "Test 2 failed" );
|
||||
}
|
||||
b.delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue