class TestCase::Module::Short {
use Fn;
static method basic : int () {
# Initialization and value check
{
my $numeric_object = Short->new(Fn->INT16_MIN());
unless ($numeric_object->value == Fn->INT16_MIN()) { return 0; }
}
# Mutable test
{
my $numeric_object = Short->new(1);
$numeric_object->set_value(10);
unless ($numeric_object->value == 10) { return 0; }
}
# Clone test
{
my $numeric_object = Short->new(5);
my $cloned_object = $numeric_object->clone;
unless ($cloned_object->value == 5) { return 0; }
$cloned_object->set_value(20);
if ($numeric_object->value == 20) { return 0; }
}
# Read-only test
{
my $numeric_object = Short->new(1);
$numeric_object->make_read_only;
eval { $numeric_object->set_value(10); };
unless (Fn->contains($@, "The object is read-only and its value cannot be changed.")) {
return 0;
}
}
return 1;
}
}