class TestCase::Module::Native::MethodCall {
use Native::MethodCall;
use Fn;
use TestCase::Point_3b;
use TestCase::Point_3s;
use TestCase::Point_3i;
use TestCase::Point_3l;
use TestCase::Point_3f;
use TestCase::Point_3d;
use Point;
use Native;
our $CALL_CALLBACK_VALUE : rw int;
our $CALL_CLASS_METHOD_VALUE : rw int;
static method call : int () {
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_byte");
{
my $ret = $class_method_call->call([(object)(byte)Fn->BYTE_MIN, (byte)1]);
unless ($ret is_type Byte) {
return 0;
}
unless ((byte)$ret == Fn->BYTE_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_short");
{
my $ret = $class_method_call->call([(object)(short)Fn->SHORT_MIN, (short)1]);
unless ($ret is_type Short) {
return 0;
}
unless ((short)$ret ==Fn->SHORT_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_int");
{
my $ret = $class_method_call->call([(object)(int)Fn->INT_MIN, (int)1]);
unless ($ret is_type Int) {
return 0;
}
unless ((int)$ret == Fn->INT_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_long");
{
my $ret = $class_method_call->call([(object)(long)Fn->LONG_MIN, (long)1]);
unless ($ret is_type Long) {
return 0;
}
unless ((long)$ret == Fn->LONG_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_float");
{
my $ret = $class_method_call->call([(object)(float)Fn->FLOAT_MIN, (float)1]);
unless ($ret is_type Float) {
return 0;
}
unless ((float)$ret == Fn->FLOAT_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_double");
{
my $ret = $class_method_call->call([(object)(double)Fn->DOUBLE_MIN, (double)1]);
unless ($ret is_type Double) {
return 0;
}
unless ((double)$ret == Fn->DOUBLE_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_byte");
{
my $ret = (byte[])$class_method_call->call([(object)[(byte)Fn->BYTE_MIN, 2, 3], [(byte)1, 4, 5]]);
unless ($ret is_type byte[]) {
return 0;
}
unless ($ret->[0] == Fn->BYTE_MIN + 1) {
return 0;
}
unless ($ret->[1] == 6) {
return 0;
}
unless ($ret->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_short");
{
my $ret = (short[])$class_method_call->call([(object)[(short)Fn->SHORT_MIN, 2, 3], [(short)1, 4, 5]]);
unless ($ret is_type short[]) {
return 0;
}
unless ($ret->[0] == Fn->SHORT_MIN + 1) {
return 0;
}
unless ($ret->[1] == 6) {
return 0;
}
unless ($ret->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_int");
{
my $ret = (int[])$class_method_call->call([(object)[(int)Fn->INT_MIN, 2, 3], [(int)1, 4, 5]]);
unless ($ret is_type int[]) {
return 0;
}
unless ($ret->[0] == Fn->INT_MIN + 1) {
return 0;
}
unless ($ret->[1] == 6) {
return 0;
}
unless ($ret->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_long");
{
my $ret = (long[])$class_method_call->call([(object)[(long)Fn->LONG_MIN, 2, 3], [(long)1, 4, 5]]);
unless ($ret is_type long[]) {
return 0;
}
unless ($ret->[0] == Fn->LONG_MIN + 1) {
return 0;
}
unless ($ret->[1] == 6) {
return 0;
}
unless ($ret->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_float");
{
my $ret = (float[])$class_method_call->call([(object)[(float)Fn->FLOAT_MIN, 2, 3], [(float)1, 4, 5]]);
unless ($ret is_type float[]) {
return 0;
}
unless ($ret->[0] == Fn->FLOAT_MIN + 1) {
return 0;
}
unless ($ret->[1] == 6) {
return 0;
}
unless ($ret->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_double");
{
my $ret = (double[])$class_method_call->call([(object)[(double)Fn->DOUBLE_MIN, 2, 3], [(double)1, 4, 5]]);
unless ($ret is_type double[]) {
return 0;
}
unless ($ret->[0] == Fn->DOUBLE_MIN + 1) {
return 0;
}
unless ($ret->[1] == 6) {
return 0;
}
unless ($ret->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_byte_ref");
{
my $out = new byte[1];
(byte[])$class_method_call->call([(object)(byte)Fn->BYTE_MIN, (byte)1, $out]);
unless ($out->[0] == Fn->BYTE_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_short_ref");
{
my $out = new short[1];
(short[])$class_method_call->call([(object)(short)Fn->SHORT_MIN, (short)1, $out]);
unless ($out->[0] == Fn->SHORT_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_int_ref");
{
my $out = new int[1];
(int[])$class_method_call->call([(object)(int)Fn->INT_MIN, (int)1, $out]);
unless ($out->[0] == Fn->INT_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_long_ref");
{
my $out = new long[1];
(long[])$class_method_call->call([(object)(long)Fn->LONG_MIN, (long)1, $out]);
unless ($out->[0] == Fn->LONG_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_float_ref");
{
my $out = new float[1];
(float[])$class_method_call->call([(object)(float)Fn->FLOAT_MIN, (float)1, $out]);
unless ($out->[0] == Fn->FLOAT_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_double_ref");
{
my $out = new double[1];
(double[])$class_method_call->call([(object)(double)Fn->DOUBLE_MIN, (double)1, $out]);
unless ($out->[0] == Fn->DOUBLE_MIN + 1) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_byte_ref");
{
my $out = new byte[3];
$class_method_call->call([(object)[(byte)Fn->BYTE_MIN, 2, 3], [(byte)1, 4, 5], $out]);
unless ($out->[0] == Fn->BYTE_MIN + 1) {
return 0;
}
unless ($out->[1] == 6) {
return 0;
}
unless ($out->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_short_ref");
{
my $out = new short[3];
$class_method_call->call([(object)[(short)Fn->SHORT_MIN, 2, 3], [(short)1, 4, 5], $out]);
unless ($out->[0] == Fn->SHORT_MIN + 1) {
return 0;
}
unless ($out->[1] == 6) {
return 0;
}
unless ($out->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_int_ref");
{
my $out = new int[3];
$class_method_call->call([(object)[(int)Fn->INT_MIN, 2, 3], [(int)1, 4, 5], $out]);
unless ($out->[0] == Fn->INT_MIN + 1) {
return 0;
}
unless ($out->[1] == 6) {
return 0;
}
unless ($out->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_long_ref");
{
my $out = new long[3];
$class_method_call->call([(object)[(long)Fn->LONG_MIN, 2, 3], [(long)1, 4, 5], $out]);
unless ($out->[0] == Fn->LONG_MIN + 1) {
return 0;
}
unless ($out->[1] == 6) {
return 0;
}
unless ($out->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_float_ref");
{
my $out = new float[3];
$class_method_call->call([(object)[(float)Fn->FLOAT_MIN, 2, 3], [(float)1, 4, 5], $out]);
unless ($out->[0] == Fn->FLOAT_MIN + 1) {
return 0;
}
unless ($out->[1] == 6) {
return 0;
}
unless ($out->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_mulnum_double_ref");
{
my $out = new double[3];
$class_method_call->call([(object)[(double)Fn->DOUBLE_MIN, 2, 3], [(double)1, 4, 5], $out]);
unless ($out->[0] == Fn->DOUBLE_MIN + 1) {
return 0;
}
unless ($out->[1] == 6) {
return 0;
}
unless ($out->[2] == 8) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("TestCase::Module::Native::MethodCall", "add_point");
{
my $ret = (Point)$class_method_call->call([(object)Point->new(Fn->INT_MIN, 2), Point->new(1, 4)]);
unless ($ret is_type Point) {
return 0;
}
unless ($ret->x == Fn->INT_MIN + 1) {
return 0;
}
unless ($ret->y == 6) {
return 0;
}
}
}
{
my $class_method_call = Native::MethodCall->new_class_method("Point", "new");
{
my $point = (Point)$class_method_call->call([(object)1, 2]);
unless ($point is_type Point) {
return 0;
}
unless ($point->x == 1) {
return 0;
}
unless ($point->y == 2) {
return 0;
}
}
}
return 1;
}
static method add_byte : byte ($arg0 : byte, $arg1 : byte) {
my $ret = (byte)($arg0 + $arg1);
return $ret;
}
static method add_short : short ($arg0 : short, $arg1 : short) {
my $ret = (short)($arg0 + $arg1);
return $ret;
}
static method add_int : int ($arg0 : int, $arg1 : int) {
my $ret = (int)($arg0 + $arg1);
return $ret;
}
static method add_long : long ($arg0 : long, $arg1 : long) {
my $ret = (long)($arg0 + $arg1);
return $ret;
}
static method add_float : float ($arg0 : float, $arg1 : float) {
my $ret = (float)($arg0 + $arg1);
return $ret;
}
static method add_double : double ($arg0 : double, $arg1 : double) {
my $ret = (double)($arg0 + $arg1);
return $ret;
}
static method add_mulnum_byte : TestCase::Point_3b ($arg0 : TestCase::Point_3b, $arg1 : TestCase::Point_3b) {
my $ret : TestCase::Point_3b;
$ret->{x} = (byte)($arg0->{x} + $arg1->{x});
$ret->{y} = (byte)($arg0->{y} + $arg1->{y});
$ret->{z} = (byte)($arg0->{z} + $arg1->{z});
return $ret;
}
static method add_mulnum_short : TestCase::Point_3s ($arg0 : TestCase::Point_3s, $arg1 : TestCase::Point_3s) {
my $ret : TestCase::Point_3s;
$ret->{x} = (short)($arg0->{x} + $arg1->{x});
$ret->{y} = (short)($arg0->{y} + $arg1->{y});
$ret->{z} = (short)($arg0->{z} + $arg1->{z});
return $ret;
}
static method add_mulnum_int : TestCase::Point_3i ($arg0 : TestCase::Point_3i, $arg1 : TestCase::Point_3i) {
my $ret : TestCase::Point_3i;
$ret->{x} = (int)($arg0->{x} + $arg1->{x});
$ret->{y} = (int)($arg0->{y} + $arg1->{y});
$ret->{z} = (int)($arg0->{z} + $arg1->{z});
return $ret;
}
static method add_mulnum_long : TestCase::Point_3l ($arg0 : TestCase::Point_3l, $arg1 : TestCase::Point_3l) {
my $ret : TestCase::Point_3l;
$ret->{x} = (long)($arg0->{x} + $arg1->{x});
$ret->{y} = (long)($arg0->{y} + $arg1->{y});
$ret->{z} = (long)($arg0->{z} + $arg1->{z});
return $ret;
}
static method add_mulnum_float : TestCase::Point_3f ($arg0 : TestCase::Point_3f, $arg1 : TestCase::Point_3f) {
my $ret : TestCase::Point_3f;
$ret->{x} = (float)($arg0->{x} + $arg1->{x});
$ret->{y} = (float)($arg0->{y} + $arg1->{y});
$ret->{z} = (float)($arg0->{z} + $arg1->{z});
return $ret;
}
static method add_mulnum_double : TestCase::Point_3d ($arg0 : TestCase::Point_3d, $arg1 : TestCase::Point_3d) {
my $ret : TestCase::Point_3d;
$ret->{x} = (double)($arg0->{x} + $arg1->{x});
$ret->{y} = (double)($arg0->{y} + $arg1->{y});
$ret->{z} = (double)($arg0->{z} + $arg1->{z});
return $ret;
}
static method add_byte_ref : void ($arg0 : byte, $arg1 : byte, $arg_out : byte*) {
$$arg_out = (byte)($arg0 + $arg1);
}
static method add_short_ref : void ($arg0 : short, $arg1 : short, $arg_out : short*) {
$$arg_out = (short)($arg0 + $arg1);
}
static method add_int_ref : void ($arg0 : int, $arg1 : int, $arg_out : int*) {
$$arg_out = (int)($arg0 + $arg1);
}
static method add_long_ref : void ($arg0 : long, $arg1 : long, $arg_out : long*) {
$$arg_out = (long)($arg0 + $arg1);
}
static method add_float_ref : void ($arg0 : float, $arg1 : float, $arg_out : float*) {
$$arg_out = (float)($arg0 + $arg1);
}
static method add_double_ref : void ($arg0 : double, $arg1 : double, $arg_out : double*) {
$$arg_out = (double)($arg0 + $arg1);
}
static method add_mulnum_byte_ref : void ($arg0 : TestCase::Point_3b, $arg1 : TestCase::Point_3b, $out : TestCase::Point_3b*) {
$out->{x} = (byte)($arg0->{x} + $arg1->{x});
$out->{y} = (byte)($arg0->{y} + $arg1->{y});
$out->{z} = (byte)($arg0->{z} + $arg1->{z});
}
static method add_mulnum_short_ref : void ($arg0 : TestCase::Point_3s, $arg1 : TestCase::Point_3s, $out : TestCase::Point_3s*) {
$out->{x} = (short)($arg0->{x} + $arg1->{x});
$out->{y} = (short)($arg0->{y} + $arg1->{y});
$out->{z} = (short)($arg0->{z} + $arg1->{z});
}
static method add_mulnum_int_ref : void ($arg0 : TestCase::Point_3i, $arg1 : TestCase::Point_3i, $out : TestCase::Point_3i*) {
$out->{x} = (int)($arg0->{x} + $arg1->{x});
$out->{y} = (int)($arg0->{y} + $arg1->{y});
$out->{z} = (int)($arg0->{z} + $arg1->{z});
}
static method add_mulnum_long_ref : void ($arg0 : TestCase::Point_3l, $arg1 : TestCase::Point_3l, $out : TestCase::Point_3l*) {
$out->{x} = (long)($arg0->{x} + $arg1->{x});
$out->{y} = (long)($arg0->{y} + $arg1->{y});
$out->{z} = (long)($arg0->{z} + $arg1->{z});
}
static method add_mulnum_float_ref : void ($arg0 : TestCase::Point_3f, $arg1 : TestCase::Point_3f, $out : TestCase::Point_3f*) {
$out->{x} = (float)($arg0->{x} + $arg1->{x});
$out->{y} = (float)($arg0->{y} + $arg1->{y});
$out->{z} = (float)($arg0->{z} + $arg1->{z});
}
static method add_mulnum_double_ref : void ($arg0 : TestCase::Point_3d, $arg1 : TestCase::Point_3d, $out : TestCase::Point_3d*) {
$out->{x} = (double)($arg0->{x} + $arg1->{x});
$out->{y} = (double)($arg0->{y} + $arg1->{y});
$out->{z} = (double)($arg0->{z} + $arg1->{z});
}
static method add_point : Point ($arg0 : Point, $arg1 : Point) {
my $x_total = $arg0->x + $arg1->x;
my $y_total = $arg0->y + $arg1->y;
my $ret = Point->new($x_total, $y_total);
return $ret;
}
static method call_callback : int () {
{
my $error_id = -1;
Native::MethodCall->call_callback(
method : void () {
TestCase::Module::Native::MethodCall->SET_CALL_CALLBACK_VALUE(1);
},
\$error_id,
);
unless ($error_id == 0) {
return 0;
}
unless ($CALL_CALLBACK_VALUE == 1) {
return 0;
}
TestCase::Module::Native::MethodCall->SET_CALL_CALLBACK_VALUE(0);
}
{
my $current_env = Native->get_current_env;
my $stack = $current_env->new_stack;
$@ = "Current Stack Error";
my $error_id = -1;
Native::MethodCall->call_callback(
method : void () {
TestCase::Module::Native::MethodCall->SET_CALL_CALLBACK_VALUE(1);
},
\$error_id,
$stack,
);
unless ($error_id == 0) {
return 0;
}
unless ($CALL_CALLBACK_VALUE == 1) {
return 0;
}
unless ($@ eq "Current Stack Error") {
return 0;
}
$@ = undef;
TestCase::Module::Native::MethodCall->SET_CALL_CALLBACK_VALUE(0);
}
{
my $current_env = Native->get_current_env;
my $stack = $current_env->new_stack;
$@ = "Current Stack Error";
my $error_id = -1;
Native::MethodCall->call_callback(
[has value : int = 2] method : void () {
TestCase::Module::Native::MethodCall->SET_CALL_CALLBACK_VALUE($self->{value});
},
\$error_id,
$stack,
);
unless ($error_id == 0) {
return 0;
}
unless ($CALL_CALLBACK_VALUE == 2) {
return 0;
}
unless ($@ eq "Current Stack Error") {
return 0;
}
$@ = undef;
TestCase::Module::Native::MethodCall->SET_CALL_CALLBACK_VALUE(0);
}
# Exceptions
{
my $current_env = Native->get_current_env;
my $stack = $current_env->new_stack;
$@ = "Current Stack Error";
my $error_id = -1;
Native::MethodCall->call_callback(
method : void () {
die "Call Back Error";
TestCase::Module::Native::MethodCall->SET_CALL_CALLBACK_VALUE(1);
},
\$error_id,
$stack,
);
if ($error_id == 0) {
return 0;
}
unless ($CALL_CALLBACK_VALUE == 0) {
return 0;
}
unless ($@ eq "Current Stack Error") {
return 0;
}
my $stack_exception = Native::MethodCall->get_exception($stack);
unless (Fn->contains($stack_exception, "Call Back Error")) {
return 0;
}
Native::MethodCall->set_exception(undef, $stack);
if (Native::MethodCall->get_exception($stack)) {
return 0;
}
$@ = undef;
}
return 1;
}
static method call_class_method : int () {
{
TestCase::Module::Native::MethodCall->SET_CALL_CLASS_METHOD_VALUE(0);
my $error_id = -1;
Native::MethodCall->call_class_method("TestCase::Module::Native::MethodCall", "set_class_var", \$error_id);
unless ($error_id == 0) {
return 0;
}
unless ($CALL_CLASS_METHOD_VALUE == 1) {
return 0;
}
}
{
TestCase::Module::Native::MethodCall->SET_CALL_CLASS_METHOD_VALUE(0);
my $error_id = -1;
my $stack = Native->get_current_stack;
Native::MethodCall->call_class_method("TestCase::Module::Native::MethodCall", "set_class_var", \$error_id, $stack);
unless ($error_id == 0) {
return 0;
}
unless ($CALL_CLASS_METHOD_VALUE == 1) {
return 0;
}
}
{
TestCase::Module::Native::MethodCall->SET_CALL_CLASS_METHOD_VALUE(0);
my $error_id = -1;
my $stack = Native->get_current_stack;
my $env = Native->get_current_env;
Native::MethodCall->call_class_method("TestCase::Module::Native::MethodCall", "set_class_var", \$error_id, $stack, $env);
unless ($error_id == 0) {
return 0;
}
unless ($CALL_CLASS_METHOD_VALUE == 1) {
return 0;
}
TestCase::Module::Native::MethodCall->SET_CALL_CLASS_METHOD_VALUE(0);
}
return 1;
}
static method set_class_var : void () {
$CALL_CLASS_METHOD_VALUE = 1;
}
}