class TestCase::Accessor {
use Point;
our $VALUE_BYTE : rw byte;
our $VALUE_SHORT : rw short;
our $VALUE_INT : rw int;
our $VALUE_LONG : rw long;
our $VALUE_FLOAT : rw float;
our $VALUE_DOUBLE : rw double;
our $VALUE_OBJECT : rw Point;
has value_byte : rw byte;
has value_short : rw short;
has value_int : rw int;
has value_long : rw long;
has value_float : rw float;
has value_double : rw double;
has value_object : rw Point;
static method field_accessor : int () {
{
my $object = new TestCase::Accessor;
$object->{value_byte} = 1;
my $value_field = $object->{value_byte};
unless ($value_field isa byte) {
return 0;
}
unless ($value_field == 1) {
return 0;
}
my $value_var = 2;
$object->set_value_byte($value_var);
my $value_reader = $object->value_byte;
unless ($value_reader isa int) {
return 0;
}
unless ($value_reader == 2) {
return 0;
}
}
{
my $object = new TestCase::Accessor;
$object->{value_short} = 1;
my $value_field = $object->{value_short};
unless ($value_field isa short) {
return 0;
}
unless ($value_field == 1) {
return 0;
}
my $value_var = 2;
$object->set_value_short($value_var);
my $value_reader = $object->value_short;
unless ($value_reader isa int) {
return 0;
}
unless ($value_reader == 2) {
return 0;
}
}
{
my $object = new TestCase::Accessor;
$object->{value_int} = 1;
my $value_field = $object->{value_int};
unless ($value_field isa int) {
return 0;
}
unless ($value_field == 1) {
return 0;
}
my $value_var = 2;
$object->set_value_int($value_var);
my $value_reader = $object->value_int;
unless ($value_reader isa int) {
return 0;
}
unless ($value_reader == 2) {
return 0;
}
}
{
my $object = new TestCase::Accessor;
$object->{value_long} = 1;
my $value_field = $object->{value_long};
unless ($value_field isa long) {
return 0;
}
unless ($value_field == 1) {
return 0;
}
my $value_var = 2;
$object->set_value_long($value_var);
my $value_reader = $object->value_long;
unless ($value_reader isa long) {
return 0;
}
unless ($value_reader == 2) {
return 0;
}
}
{
my $object = new TestCase::Accessor;
$object->{value_float} = 1f;
my $value_field = $object->{value_float};
unless ($value_field isa float) {
return 0;
}
unless ($value_field == 1f) {
return 0;
}
my $value_var = 2;
$object->set_value_float($value_var);
my $value_reader = $object->value_float;
unless ($value_reader isa float) {
return 0;
}
unless ($value_reader == 2f) {
return 0;
}
}
{
my $object = new TestCase::Accessor;
$object->{value_double} = 1;
my $value_field = $object->{value_double};
unless ($value_field isa double) {
return 0;
}
unless ($value_field == 1) {
return 0;
}
my $value_var = 2;
$object->set_value_double($value_var);
my $value_reader = $object->value_double;
unless ($value_reader isa double) {
return 0;
}
unless ($value_reader == 2) {
return 0;
}
}
{
my $object = new TestCase::Accessor;
my $point = Point->new;
$object->{value_object} = $point;
my $value_field = $object->{value_object};
unless ($value_field isa Point) {
return 0;
}
unless ($value_field == $point) {
return 0;
}
my $value_var = Point->new;
$object->set_value_object($value_var);
my $value_reader = $object->value_object;
unless ($value_reader isa Point) {
return 0;
}
unless ($value_reader == $value_var) {
return 0;
}
}
return 1;
}
static method class_var_accessor : int () {
{
$VALUE_BYTE = 1;
unless ($VALUE_BYTE isa byte) {
return 0;
}
unless ($VALUE_BYTE == 1) {
return 0;
}
TestCase::Accessor->SET_VALUE_BYTE(2);
unless (TestCase::Accessor->VALUE_BYTE isa int) {
return 0;
}
unless (TestCase::Accessor->VALUE_BYTE == 2) {
return 0;
}
}
{
$VALUE_SHORT = 1;
unless ($VALUE_SHORT isa short) {
return 0;
}
unless ($VALUE_SHORT == 1) {
return 0;
}
TestCase::Accessor->SET_VALUE_SHORT(2);
unless (TestCase::Accessor->VALUE_SHORT isa int) {
return 0;
}
unless (TestCase::Accessor->VALUE_SHORT == 2) {
return 0;
}
}
{
$VALUE_INT = 1;
unless ($VALUE_INT isa int) {
return 0;
}
unless ($VALUE_INT == 1) {
return 0;
}
TestCase::Accessor->SET_VALUE_INT(2);
unless (TestCase::Accessor->VALUE_INT isa int) {
return 0;
}
unless (TestCase::Accessor->VALUE_INT == 2) {
return 0;
}
}
{
$VALUE_LONG = 1;
unless ($VALUE_LONG isa long) {
return 0;
}
unless ($VALUE_LONG == 1) {
return 0;
}
TestCase::Accessor->SET_VALUE_LONG(2);
unless (TestCase::Accessor->VALUE_LONG isa long) {
return 0;
}
unless (TestCase::Accessor->VALUE_LONG == 2) {
return 0;
}
}
{
$VALUE_FLOAT = 1;
unless ($VALUE_FLOAT isa float) {
return 0;
}
unless ($VALUE_FLOAT == 1) {
return 0;
}
TestCase::Accessor->SET_VALUE_FLOAT(2);
unless (TestCase::Accessor->VALUE_FLOAT isa float) {
return 0;
}
unless (TestCase::Accessor->VALUE_FLOAT == 2) {
return 0;
}
}
{
$VALUE_DOUBLE = 1;
unless ($VALUE_DOUBLE isa double) {
return 0;
}
unless ($VALUE_DOUBLE == 1) {
return 0;
}
TestCase::Accessor->SET_VALUE_DOUBLE(2);
unless (TestCase::Accessor->VALUE_DOUBLE isa double) {
return 0;
}
unless (TestCase::Accessor->VALUE_DOUBLE == 2) {
return 0;
}
}
{
my $value_object = Point->new;
$VALUE_OBJECT = $value_object;
unless ($VALUE_OBJECT isa Point) {
return 0;
}
unless ($VALUE_OBJECT == $value_object) {
return 0;
}
my $value_object2 = Point->new;
TestCase::Accessor->SET_VALUE_OBJECT($value_object2);
unless (TestCase::Accessor->VALUE_OBJECT isa Point) {
return 0;
}
unless (TestCase::Accessor->VALUE_OBJECT == $value_object2) {
return 0;
}
$VALUE_OBJECT = undef;
}
return 1;
}
}