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

use lib "t/testlib";
use strict;
use SPVM 'TestCase::Operator::ArrayMiddleSize';
# Start objects count
my $api = SPVM::api();
my $start_memory_blocks_count = $api->get_memory_blocks_count();
my $free_result = `free`;
my $at_least_memory_size;
if ($free_result =~ /Mem: +(\d+)/) {
$at_least_memory_size = $1;
}
SKIP: {
unless (defined $at_least_memory_size && $at_least_memory_size > 1_026_060) {
skip "Memory must need at least $at_least_memory_size", 6;
}
ok(SPVM::TestCase::Operator::ArrayMiddleSize->array_middle_index_byte);
ok(SPVM::TestCase::Operator::ArrayMiddleSize->array_middle_index_short);
ok(SPVM::TestCase::Operator::ArrayMiddleSize->array_middle_index_int);
ok(SPVM::TestCase::Operator::ArrayMiddleSize->array_middle_index_long);
ok(SPVM::TestCase::Operator::ArrayMiddleSize->array_middle_index_float);
ok(SPVM::TestCase::Operator::ArrayMiddleSize->array_middle_index_double);
};
# 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;