director_smartptr runtime tests enhancement
Add same changes from previous commit to additional languages
This commit is contained in:
parent
4bf607589f
commit
241460eddc
3 changed files with 72 additions and 0 deletions
|
|
@ -26,6 +26,29 @@ public class runme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class director_smartptr_MyBarFooDerived : FooDerived
|
||||||
|
{
|
||||||
|
public override string ping()
|
||||||
|
{
|
||||||
|
return "director_smartptr_MyBarFooDerived.ping()";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string pong()
|
||||||
|
{
|
||||||
|
return "director_smartptr_MyBarFooDerived.pong();" + ping();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string upcall(FooBar fooBarPtr)
|
||||||
|
{
|
||||||
|
return "overrideDerived;" + fooBarPtr.FooBarDo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Foo makeFoo()
|
||||||
|
{
|
||||||
|
return new Foo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void check(string got, string expected)
|
private static void check(string got, string expected)
|
||||||
{
|
{
|
||||||
if (got != expected)
|
if (got != expected)
|
||||||
|
|
@ -49,5 +72,11 @@ public class runme
|
||||||
Foo myFoo2 = new Foo().makeFoo();
|
Foo myFoo2 = new Foo().makeFoo();
|
||||||
check(myFoo2.pong(), "Foo::pong();Foo::ping()");
|
check(myFoo2.pong(), "Foo::pong();Foo::ping()");
|
||||||
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()");
|
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()");
|
||||||
|
|
||||||
|
FooDerived myBarFooDerived = new director_smartptr_MyBarFooDerived();
|
||||||
|
check(myBarFooDerived.ping(), "director_smartptr_MyBarFooDerived.ping()");
|
||||||
|
check(FooDerived.callPong(myBarFooDerived), "director_smartptr_MyBarFooDerived.pong();director_smartptr_MyBarFooDerived.ping()");
|
||||||
|
check(FooDerived.callUpcall(myBarFooDerived, fooBar), "overrideDerived;Bar::Foo2::Foo2Bar()");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,20 @@ class director_smartptr_MyBarFoo(Foo):
|
||||||
def makeFoo(self):
|
def makeFoo(self):
|
||||||
return Foo()
|
return Foo()
|
||||||
|
|
||||||
|
class director_smartptr_MyBarFooDerived(FooDerived):
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
return "director_smartptr_MyBarFooDerived.ping()"
|
||||||
|
|
||||||
|
def pong(self):
|
||||||
|
return "director_smartptr_MyBarFooDerived.pong();" + self.ping()
|
||||||
|
|
||||||
|
def upcall(self, fooBarPtr):
|
||||||
|
return "overrideDerived;" + fooBarPtr.FooBarDo()
|
||||||
|
|
||||||
|
def makeFoo(self):
|
||||||
|
return Foo()
|
||||||
|
|
||||||
def check(got, expected):
|
def check(got, expected):
|
||||||
if (got != expected):
|
if (got != expected):
|
||||||
raise RuntimeError, "Failed, got: " + got + " expected: " + expected
|
raise RuntimeError, "Failed, got: " + got + " expected: " + expected
|
||||||
|
|
@ -35,3 +49,8 @@ myFoo2 = Foo().makeFoo()
|
||||||
check(myFoo2.pong(), "Foo::pong();Foo::ping()")
|
check(myFoo2.pong(), "Foo::pong();Foo::ping()")
|
||||||
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()")
|
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()")
|
||||||
check(myFoo2.upcall(FooBar()), "Bar::Foo2::Foo2Bar()")
|
check(myFoo2.upcall(FooBar()), "Bar::Foo2::Foo2Bar()")
|
||||||
|
|
||||||
|
myBarFooDerived = director_smartptr_MyBarFooDerived()
|
||||||
|
check(myBarFooDerived.ping(), "director_smartptr_MyBarFooDerived.ping()")
|
||||||
|
check(FooDerived.callPong(myBarFooDerived), "director_smartptr_MyBarFooDerived.pong();director_smartptr_MyBarFooDerived.ping()")
|
||||||
|
check(FooDerived.callUpcall(myBarFooDerived, fooBar), "overrideDerived;Bar::Foo2::Foo2Bar()")
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,25 @@ class Director_smartptr_MyBarFoo < Foo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Director_smartptr_MyBarFooDerived < FooDerived
|
||||||
|
|
||||||
|
def ping()
|
||||||
|
return "director_smartptr_MyBarFooDerived.ping()"
|
||||||
|
end
|
||||||
|
|
||||||
|
def pong()
|
||||||
|
return "director_smartptr_MyBarFooDerived.pong();" + ping()
|
||||||
|
end
|
||||||
|
|
||||||
|
def upcall(fooBarPtr)
|
||||||
|
return "overrideDerived;" + fooBarPtr.FooBarDo()
|
||||||
|
end
|
||||||
|
|
||||||
|
def makeFoo()
|
||||||
|
return Foo.new()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def check(got, expected)
|
def check(got, expected)
|
||||||
if (got != expected)
|
if (got != expected)
|
||||||
raise RuntimeError, "Failed, got: #{got} expected: #{expected}"
|
raise RuntimeError, "Failed, got: #{got} expected: #{expected}"
|
||||||
|
|
@ -52,3 +71,8 @@ myFoo2 = Foo.new().makeFoo()
|
||||||
check(myFoo2.pong(), "Foo::pong();Foo::ping()")
|
check(myFoo2.pong(), "Foo::pong();Foo::ping()")
|
||||||
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()")
|
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()")
|
||||||
check(myFoo2.upcall(FooBar.new()), "Bar::Foo2::Foo2Bar()")
|
check(myFoo2.upcall(FooBar.new()), "Bar::Foo2::Foo2Bar()")
|
||||||
|
|
||||||
|
myBarFooDerived = Director_smartptr_MyBarFooDerived.new()
|
||||||
|
check(myBarFooDerived.ping(), "director_smartptr_MyBarFooDerived.ping()")
|
||||||
|
check(FooDerived.callPong(myBarFooDerived), "director_smartptr_MyBarFooDerived.pong();director_smartptr_MyBarFooDerived.ping()")
|
||||||
|
check(FooDerived.callUpcall(myBarFooDerived, fooBar), "overrideDerived;Bar::Foo2::Foo2Bar()")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue