Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cppia test for multi level inheritance in host #1154

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/cppia/Client.hx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ class Client
return;
}


final extending = new ClientExtendedExtendedRoot();

extending.addValue();

Common.clientRoot = extending;


Common.clientImplementation = new ClientOne();
Common.status = "ok";

Expand Down
7 changes: 7 additions & 0 deletions test/cppia/ClientExtendedExtendedRoot.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ClientExtendedExtendedRoot extends HostExtendedRoot {
override function addValue() {
super.addValue();

values.push(2);
}
}
1 change: 1 addition & 0 deletions test/cppia/Common.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Common
public static var status:String = "tests not run";
public static var hostImplementation:pack.HostInterface;
public static var clientImplementation:pack.HostInterface;
public static var clientRoot:HostRoot;

public static var callbackSet:Int = 0;
public static var callback: Void->Void;
Expand Down
15 changes: 15 additions & 0 deletions test/cppia/CppiaHost.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import cpp.cppia.Host;

import HostBase;
import HostExtendedRoot;

class HostOne implements pack.HostInterface
{
Expand Down Expand Up @@ -84,6 +85,20 @@ class CppiaHost
Sys.println("Bad cppia closure");
Sys.exit(-1);
}

#if (haxe >= version("4.3.6"))
if (Common.clientRoot == null) {
Sys.println("null client root class");
Sys.exit(-1);
}
switch Common.clientRoot.values {
case [ 0, 1, 2 ]:
//
case _:
Sys.println("Unexpected items in array");
Sys.exit(-1);
}
#end
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions test/cppia/HostExtendedRoot.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class HostExtendedRoot extends HostRoot {
override function addValue() {
super.addValue();

values.push(1);
}
}
11 changes: 11 additions & 0 deletions test/cppia/HostRoot.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class HostRoot {
public final values:Array<Int>;

public function new() {
values = [];
}

public function addValue() {
values.push(0);
}
}