From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

use lib "t/testlib";
use strict;
use SPVM 'TestCase::Operator::ArrayAccess';
my $api = SPVM::api();
# Start objects count
my $start_memory_blocks_count = $api->get_memory_blocks_count();
# array - set and get array element, first element
{
my $element = SPVM::TestCase::Operator::ArrayAccess->array_set_and_get_array_element_first();
is($element, 345);
}
# array - set and get array element, last element
{
my $element = SPVM::TestCase::Operator::ArrayAccess->array_set_and_get_array_element_last();
is($element, 298);
}
# array - culcurate sum by for
{
my $total = SPVM::TestCase::Operator::ArrayAccess->array_culcurate_sum_by_for();
is($total, 6);
}
# All object is freed
$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;