use
SPVM
'TestCase::Operator::MethodCall'
;
my
$build_dir
=
$ENV
{SPVM_BUILD_DIR};
my
$BYTE_MAX
= 127;
my
$BYTE_MIN
= -128;
my
$SHORT_MAX
= 32767;
my
$SHORT_MIN
= -32768;
my
$INT_MAX
= 2147483647;
my
$INT_MIN
= -2147483648;
my
$LONG_MAX
= 9223372036854775807;
my
$LONG_MIN
= -9223372036854775808;
my
$FLOAT_PRECICE
= 16384.5;
my
$DOUBLE_PRECICE
= 65536.5;
my
$api
= SPVM::api();
my
$start_memory_blocks_count
=
$api
->get_memory_blocks_count();
{
ok(SPVM::TestCase::Operator::MethodCall->call_keyword_name_method);
}
{
ok(SPVM::TestCase::Operator::MethodCall->test_import_method);
}
{
ok(SPVM::TestCase::Operator::MethodCall->return_mulnum_automatical_numeric_convertion);
}
{
ok(SPVM::TestCase::Operator::MethodCall->cb_obj_capture);
ok(SPVM::TestCase::Operator::MethodCall->cb_obj_call_cb_obj);
ok(SPVM::TestCase::Operator::MethodCall->cb_obj_call_cb_obj_from_callback);
}
{
ok(SPVM::TestCase::Operator::MethodCall->test_arg_byte);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_short);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_int);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_long);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_float);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_double);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_object);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_ref);
}
{
ok(SPVM::TestCase::Operator::MethodCall->test_arg_mulnum_byte);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_mulnum_short);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_mulnum_int);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_mulnum_long);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_mulnum_float);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_mulnum_double);
ok(SPVM::TestCase::Operator::MethodCall->test_arg_mulnum_ref);
}
{
ok(SPVM::TestCase::Operator::MethodCall->return_mulnum_byte);
ok(SPVM::TestCase::Operator::MethodCall->return_mulnum_short);
ok(SPVM::TestCase::Operator::MethodCall->return_mulnum_int);
ok(SPVM::TestCase::Operator::MethodCall->return_mulnum_long);
ok(SPVM::TestCase::Operator::MethodCall->return_mulnum_float);
ok(SPVM::TestCase::Operator::MethodCall->return_mulnum_double);
}
{
ok(SPVM::TestCase::Operator::MethodCall->push_arg_undef);
}
{
ok(SPVM::TestCase::Operator::MethodCall->call_method_last_camma);
ok(SPVM::TestCase::Operator::MethodCall->call_method_undef(
undef
));
}
{
ok(SPVM::TestCase::Operator::MethodCall->call_void);
}
{
ok(SPVM::TestCase::Operator::MethodCall->default_return_mulnum_byte);
ok(SPVM::TestCase::Operator::MethodCall->default_return_mulnum_short);
ok(SPVM::TestCase::Operator::MethodCall->default_return_mulnum_int);
ok(SPVM::TestCase::Operator::MethodCall->default_return_mulnum_long);
ok(SPVM::TestCase::Operator::MethodCall->default_return_mulnum_float);
ok(SPVM::TestCase::Operator::MethodCall->default_return_mulnum_double);
ok(SPVM::TestCase::Operator::MethodCall->default_return_mulnum_object);
}
{
ok(SPVM::TestCase::Operator::MethodCall->call_method_nest);
}
{
ok(SPVM::TestCase::Operator::MethodCall->call_method_args_convertion);
}
{
{
ok(SPVM::TestCase::Operator::MethodCall->call_method_args_byte(0,
$BYTE_MAX
,
$BYTE_MIN
));
ok(SPVM::TestCase::Operator::MethodCall->call_method_args_short(0,
$SHORT_MAX
,
$SHORT_MIN
));
ok(SPVM::TestCase::Operator::MethodCall->call_method_args_int(0,
$INT_MAX
,
$INT_MIN
));
ok(SPVM::TestCase::Operator::MethodCall->call_method_args_long(0,
$LONG_MAX
,
$LONG_MIN
));
}
}
{
{
my
$sp_values
=
$api
->new_byte_array([1, 2, 3]);
is(SPVM::TestCase::Operator::MethodCall->call_method_byte_array(
$sp_values
), 6);
}
{
my
$sp_values
=
$api
->new_short_array([1, 2, 3]);
is(SPVM::TestCase::Operator::MethodCall->call_method_short_array(
$sp_values
), 6);
}
{
my
$sp_values
=
$api
->new_int_array([1, 2, 3]);
is(SPVM::TestCase::Operator::MethodCall->call_method_int_array(
$sp_values
), 6);
}
{
my
$sp_values
=
$api
->new_long_array([1, 2, 3]);
is(SPVM::TestCase::Operator::MethodCall->call_method_long_array(
$sp_values
), 6);
}
{
my
$sp_values
=
$api
->new_float_array([0.5, 0.5, 1.0]);
is(SPVM::TestCase::Operator::MethodCall->call_method_float_array(
$sp_values
), 2.0);
}
{
my
$sp_values
=
$api
->new_double_array([0.5, 0.5, 1.0]);
is(SPVM::TestCase::Operator::MethodCall->call_method_double_array(
$sp_values
), 2.0);
}
}
{
{
my
$api
= SPVM::api();
my
$start_memory_blocks_count
=
$api
->get_memory_blocks_count();
SPVM::TestCase::Operator::MethodCall->call_method_assign();
my
$end_memory_blocks_count
=
$api
->get_memory_blocks_count();
is(
$start_memory_blocks_count
,
$end_memory_blocks_count
);
}
}
{
{
my
$sp_values
= SPVM::TestCase::Operator::MethodCall->call_method_return_byte_array();
SPVM::TestCase::Operator::MethodCall->call_method_return_byte_array_check(
$sp_values
);
}
{
my
$sp_values
= SPVM::TestCase::Operator::MethodCall->call_method_return_short_array();
SPVM::TestCase::Operator::MethodCall->call_method_return_short_array_check(
$sp_values
);
}
{
my
$sp_values
= SPVM::TestCase::Operator::MethodCall->call_method_return_int_array();
SPVM::TestCase::Operator::MethodCall->call_method_return_int_array_check(
$sp_values
);
}
{
my
$sp_values
= SPVM::TestCase::Operator::MethodCall->call_method_return_long_array();
SPVM::TestCase::Operator::MethodCall->call_method_return_long_array_check(
$sp_values
);
}
{
my
$sp_values
= SPVM::TestCase::Operator::MethodCall->call_method_return_float_array();
SPVM::TestCase::Operator::MethodCall->call_method_return_float_array_check(
$sp_values
);
}
{
my
$sp_values
= SPVM::TestCase::Operator::MethodCall->call_method_return_double_array();
SPVM::TestCase::Operator::MethodCall->call_method_return_double_array_check(
$sp_values
);
}
}
{
{
my
$ret
= SPVM::TestCase::Operator::MethodCall->args_max_count((1) x 254, 2);
is(
$ret
, 2);
}
{
my
$ret
= SPVM::TestCase::Operator::MethodCall->args_max_count_mulnum((1) x 253, {
re
=> 2,
im
=> 3});
is_deeply(
$ret
, {
re
=> 2,
im
=> 3});
}
}
{
{
my
$precompile_class_file
=
"$build_dir/work/lib/SPVM/TestCase/Operator/MethodCall.precompile.$Config{dlext}"
;
ok(-f
$precompile_class_file
);
}
{
my
$ret
= SPVM::TestCase::Operator::MethodCall->precompile_sum(2, 3);
is(
$ret
, 5);
}
}
{
1;
}
{
ok(SPVM::TestCase::Operator::MethodCall->optional_args);
}
{
ok(SPVM::TestCase::Operator::MethodCall->args_width);
}
{
{
ok(SPVM::TestCase::Operator::MethodCall->call_interface_method_exception);
}
}
{
{
ok(SPVM::TestCase::Operator::MethodCall->call_recursive);
}
}
{
{
ok(SPVM::TestCase::Operator::MethodCall->inheritance);
}
}
$api
->set_exception(
undef
);
my
$end_memory_blocks_count
=
$api
->get_memory_blocks_count();
is(
$end_memory_blocks_count
,
$start_memory_blocks_count
);
done_testing;