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

class TestCase::Operator::ClassVar {
use TestCase::Minimal;
use TestCase::Simple;
use Fn;
use Array;
our $lower_var : int;
our $CLASS_VAR_INT : int;
our $CLASS_VAR_LONG : long;
our $CLASS_VAR_MINIMAL : TestCase::Minimal;
our $CLASS_VAR_INT2 : int;
our $CLASS_VAR_LONG2 : long;
our $CLASS_VAR_MINIMAL2 : TestCase::Minimal;
our $NAME : int;
our ${NAME_BRACE} : int;
our $_NAME : int;
our $name : int;
our $ACCESSOR : rw int;
static method class_var : int () {
unless ($TestCase::Operator::ClassVar::CLASS_VAR_INT == 0) {
return 0;
}
$TestCase::Operator::ClassVar::CLASS_VAR_INT = Fn->INT32_MAX();
unless ($TestCase::Operator::ClassVar::CLASS_VAR_INT == Fn->INT32_MAX()) {
return 0;
}
$TestCase::Operator::ClassVar::CLASS_VAR_LONG = Fn->INT64_MAX();
unless ($TestCase::Operator::ClassVar::CLASS_VAR_LONG == Fn->INT64_MAX()) {
return 0;
}
$TestCase::Operator::ClassVar::CLASS_VAR_MINIMAL = TestCase::Minimal->new();
$TestCase::Operator::ClassVar::CLASS_VAR_MINIMAL->set_x(4);
$TestCase::Operator::ClassVar::CLASS_VAR_MINIMAL->set_x(4);
unless ($TestCase::Operator::ClassVar::CLASS_VAR_MINIMAL->x) {
return 0;
}
$TestCase::Operator::ClassVar::CLASS_VAR_MINIMAL = undef;
return 1;
}
static method class_var_name : int () {
$NAME = 1;
${NAME_BRACE} = 2;
$_NAME = 3;
$name = 4;
unless ($NAME == 1) {
return 0;
}
unless ($TestCase::Operator::ClassVar::NAME == 1) {
return 0;
}
unless (${NAME_BRACE} == 2) {
return 0;
}
unless (${TestCase::Operator::ClassVar::NAME_BRACE} == 2) {
return 0;
}
unless ($_NAME == 3) {
return 0;
}
unless ($TestCase::Operator::ClassVar::_NAME == 3) {
return 0;
}
unless ($name == 4) {
return 0;
}
unless ($TestCase::Operator::ClassVar::name == 4) {
return 0;
}
return 1;
}
static method class_var_other_class : int () {
unless ($TestCase::Simple::FOO == 0) {
return 0;
}
$TestCase::Simple::FOO = 1;
unless ($TestCase::Simple::FOO == 1) {
return 0;
}
return 1;
}
static method field_method : int () {
TestCase::Operator::ClassVar->SET_ACCESSOR(3);
unless ($TestCase::Operator::ClassVar::ACCESSOR == 3) {
return 0;
}
unless (TestCase::Operator::ClassVar->ACCESSOR == 3) {
return 0;
}
return 1;
}
}