Skip to content

Commit

Permalink
add cppia test for multi level inheritance in host
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan63 committed Sep 15, 2024
1 parent 08f88ff commit d71575f
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
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
14 changes: 14 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,19 @@ class CppiaHost
Sys.println("Bad cppia closure");
Sys.exit(-1);
}

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);
}
}
}
}
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);
}
}

0 comments on commit d71575f

Please sign in to comment.