Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Enhance Java and C# test - Add Ruby test
- Loading branch information
Showing
4 changed files
with
107 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,53 @@ | ||
using director_smartptrNamespace; | ||
using System; | ||
|
||
public class runme | ||
{ | ||
|
||
private class director_smartptr_MyBarFoo : Foo | ||
{ | ||
public override string ping() | ||
{ | ||
return "director_smartptr_MyBarFoo.ping();"; | ||
return "director_smartptr_MyBarFoo.ping()"; | ||
} | ||
|
||
public override string pong() | ||
{ | ||
return "director_smartptr_MyBarFoo.pong();" + ping(); | ||
} | ||
|
||
public override string fooBar(FooBar fooBar) | ||
public override string upcall(FooBar fooBarPtr) | ||
{ | ||
return fooBar.FooBarDo(); | ||
return "override;" + fooBarPtr.FooBarDo(); | ||
} | ||
|
||
public override Foo makeFoo() | ||
{ | ||
return new Foo(); | ||
} | ||
} | ||
|
||
public override FooBar makeFooBar() | ||
{ | ||
return new FooBar(); | ||
} | ||
private static void check(string got, string expected) | ||
{ | ||
if (got != expected) | ||
throw new ApplicationException("Failed, got: " + got + " expected: " + expected); | ||
} | ||
|
||
static void Main() | ||
{ | ||
director_smartptr_MyBarFoo myBarFoo = | ||
new director_smartptr_MyBarFoo(); | ||
FooBar fooBar = new FooBar(); | ||
|
||
Foo myBarFoo = new director_smartptr_MyBarFoo(); | ||
check(myBarFoo.ping(), "director_smartptr_MyBarFoo.ping()"); | ||
check(Foo.callPong(myBarFoo), "director_smartptr_MyBarFoo.pong();director_smartptr_MyBarFoo.ping()"); | ||
check(Foo.callUpcall(myBarFoo, fooBar), "override;Bar::Foo2::Foo2Bar()"); | ||
|
||
Foo myFoo = myBarFoo.makeFoo(); | ||
check(myFoo.pong(), "Foo::pong();Foo::ping()"); | ||
check(Foo.callPong(myFoo), "Foo::pong();Foo::ping()"); | ||
check(myFoo.upcall(new FooBar()), "Bar::Foo2::Foo2Bar()"); | ||
|
||
myBarFoo.ping(); | ||
Foo myFoo2 = new Foo().makeFoo(); | ||
check(myFoo2.pong(), "Foo::pong();Foo::ping()"); | ||
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env ruby | ||
# | ||
# Put description here | ||
# | ||
# | ||
# | ||
# | ||
# | ||
|
||
require 'director_smartptr' | ||
|
||
include Director_smartptr | ||
|
||
class Director_smartptr_MyBarFoo < Foo | ||
|
||
def ping() | ||
return "director_smartptr_MyBarFoo.ping()" | ||
end | ||
|
||
def pong() | ||
return "director_smartptr_MyBarFoo.pong();" + ping() | ||
end | ||
|
||
def upcall(fooBarPtr) | ||
return "override;" + fooBarPtr.FooBarDo() | ||
end | ||
|
||
def makeFoo() | ||
return Foo.new() | ||
end | ||
end | ||
|
||
def check(got, expected) | ||
if (got != expected) | ||
raise RuntimeError, "Failed, got: #{got} expected: #{expected}" | ||
end | ||
end | ||
|
||
fooBar = Director_smartptr::FooBar.new() | ||
|
||
myBarFoo = Director_smartptr_MyBarFoo.new() | ||
check(myBarFoo.ping(), "director_smartptr_MyBarFoo.ping()") | ||
check(Foo.callPong(myBarFoo), "director_smartptr_MyBarFoo.pong();director_smartptr_MyBarFoo.ping()") | ||
check(Foo.callUpcall(myBarFoo, fooBar), "override;Bar::Foo2::Foo2Bar()") | ||
|
||
myFoo = myBarFoo.makeFoo() | ||
check(myFoo.pong(), "Foo::pong();Foo::ping()") | ||
check(Foo.callPong(myFoo), "Foo::pong();Foo::ping()") | ||
check(myFoo.upcall(FooBar.new()), "Bar::Foo2::Foo2Bar()") | ||
|
||
myFoo2 = Foo.new().makeFoo() | ||
check(myFoo2.pong(), "Foo::pong();Foo::ping()") | ||
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()") | ||
check(myFoo2.upcall(FooBar.new()), "Bar::Foo2::Foo2Bar()") |