package TestCase::ComparisonOperator {
use TestCase::Minimal;
sub string_eq : int () {
my $string = "abc";
my $string_same = "abc";
my $string_short = "ab";
my $string_long = "abcd";
my $string_different_short= "ad";
my $string_different_long= "adcd";
my $string_empty = "";
my $string_undef : string;
# eq
my $ok = 0;
unless ($string eq $string_same) {
return 0;
}
unless (!($string eq $string_short)) {
return 0;
}
unless (!($string eq $string_long)) {
return 0;
}
unless (!($string eq $string_different_short)) {
return 0;
}
unless (!($string eq $string_different_long)) {
return 0;
}
unless (!($string eq $string_empty)) {
return 0;
}
{
my $ret = $string eq $string_same;
unless ($ret == 1) {
return 0;
}
}
{
my $ret = $string eq $string_short;
unless ($ret == 0) {
return 0;
}
}
{
eval {
if ($string_undef eq $string) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
{
eval {
if ($string eq $string_undef) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
return 1;
}
sub string_ne : int () {
my $string = "abc";
my $string_same = "abc";
my $string_short = "ab";
my $string_long = "abcd";
my $string_different_short= "ad";
my $string_different_long= "adcd";
my $string_empty = "";
my $string_undef : string;
# ne
unless (!($string ne $string_same)) {
return 0;
}
unless (($string ne $string_short)) {
return 0;
}
unless (($string ne $string_long)) {
return 0;
}
unless (($string ne $string_different_short)) {
return 0;
}
unless (($string ne $string_different_long)) {
return 0;
}
unless (($string ne $string_empty)) {
return 0;
}
{
eval {
if ($string_undef ne $string) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
{
eval {
if ($string ne $string_undef) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
return 1;
}
sub string_gt : int () {
my $string = "abc";
my $string_same = "abc";
my $string_short = "ab";
my $string_long = "abcd";
my $string_different_short= "ad";
my $string_different_long= "adcd";
my $string_empty = "";
my $string_undef : string;
# gt
unless (!($string gt $string_same)) {
return 0;
}
unless ($string gt $string_short) {
return 0;
}
unless (!($string gt $string_long)) {
return 0;
}
unless (!($string gt $string_different_short)) {
return 0;
}
unless (!($string gt $string_different_long)) {
return 0;
}
unless ($string gt $string_empty) {
return 0;
}
{
eval {
if ($string_undef gt $string) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
{
eval {
if ($string gt $string_undef) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
return 1;
}
sub string_ge : int () {
my $string = "abc";
my $string_same = "abc";
my $string_short = "ab";
my $string_long = "abcd";
my $string_different_short= "ad";
my $string_different_long= "adcd";
my $string_empty = "";
my $string_undef : string;
# ge
unless ($string ge $string_same) {
return 0;
}
unless ($string ge $string_short) {
return 0;
}
unless (!($string ge $string_long)) {
return 0;
}
unless (!($string ge $string_different_short)) {
return 0;
}
unless (!($string ge $string_different_long)) {
return 0;
}
unless ($string ge $string_empty) {
return 0;
}
{
eval {
if ($string_undef ge $string) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
{
eval {
if ($string ge $string_undef) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
return 1;
}
sub string_lt : int () {
my $string = "abc";
my $string_same = "abc";
my $string_short = "ab";
my $string_long = "abcd";
my $string_different_short= "ad";
my $string_different_long= "adcd";
my $string_empty = "";
my $string_undef : string;
# lt
unless ($string lt $string_same) {
return 0;
}
unless (!($string lt $string_short)) {
return 0;
}
unless ($string lt $string_long) {
return 0;
}
unless ($string lt $string_different_short) {
return 0;
}
unless ($string lt $string_different_long) {
return 0;
}
unless (!($string lt $string_empty)) {
return 0;
}
{
eval {
if ($string_undef lt $string) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
{
eval {
if ($string lt $string_undef) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
return 1;
}
sub string_le : int () {
my $string = "abc";
my $string_same = "abc";
my $string_short = "ab";
my $string_long = "abcd";
my $string_different_short= "ad";
my $string_different_long= "adcd";
my $string_empty = "";
my $string_undef : string;
# le
my $ok = 0;
unless ($string le $string_same) {
return 0;
}
unless (!($string le $string_short)) {
return 0;
}
unless ($string le $string_long) {
return 0;
}
unless ($string le $string_different_short) {
return 0;
}
unless ($string le $string_different_long) {
return 0;
}
unless (!($string le $string_empty)) {
return 0;
}
{
eval {
if ($string_undef le $string) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
{
eval {
if ($string le $string_undef) {
}
};
unless ($@) {
return 0;
}
$@ = undef;
}
return 1;
}
# Bool
sub bool_true_byte : int () {
if ((int)(byte)1) {
return 1;
}
return 0;
}
sub bool_true_short : int () {
if ((int)(short)1) {
return 1;
}
return 0;
}
sub bool_true_int : int () {
if (1) {
return 1;
}
return 0;
}
sub bool_true_long : int () {
if (1L) {
return 1;
}
return 0;
}
sub bool_true_float : int () {
if (1.0f) {
return 1;
}
return 0;
}
sub bool_true_double : int () {
if (1.0) {
return 1;
}
return 0;
}
sub bool_true_object : int () {
if (TestCase::Minimal->new) {
return 1;
}
return 0;
}
sub bool_false_byte : int () {
if ((int)(byte)0) {
return 0;
}
return 1;
}
sub bool_false_short : int () {
if ((int)(short)0) {
return 0;
}
return 1;
}
sub bool_false_int : int () {
if (0) {
return 0;
}
return 1;
}
sub bool_false_long : int () {
if (0L) {
return 0;
}
return 1;
}
sub bool_false_float : int () {
if (0.0f) {
return 0;
}
return 1;
}
sub bool_false_double : int () {
if (0.0) {
return 0;
}
return 1;
}
sub bool_false_object : int () {
if (undef) {
return 0;
}
return 1;
}
sub bool_else : int () {
if (0) {
return 0;
}
else {
return 1;
}
return 0;
}
sub bool_elsif : int () {
if (0) {
return 0;
}
elsif(1) {
return 1;
}
else {
return 0;
}
return 0;
}
sub bool_elsbool_2 : int () {
if (0) {
return 0;
}
elsif(0) {
return 0;
}
elsif(1) {
return 1;
}
else {
return 0;
}
return 0;
}
sub bool_duplicate : int () {
if (1) {
if (0) {
return 0;
}
elsif (1) {
return 1;
}
else {
return 0;
}
}
else {
return 0;
}
}
# eq
sub numeric_eq_undef : int () {
my $test_case : TestCase::Minimal = undef;
if (undef == undef) {
if ($test_case == undef) {
if (undef == $test_case) {
return 1;
}
}
}
return 0;
}
sub numeric_eq_byte_same : int () {
if ((byte)3 == (byte)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_eq_byte_different : int () {
if ((byte)3 == (byte)2) {
return 0;
}
else {
return 1;
}
}
sub numeric_eq_short_same : int () {
if ((short)3 == (short)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_eq_short_different : int () {
if ((short)3 == (short)2) {
return 0;
}
else {
return 1;
}
}
sub numeric_eq_int_same : int () {
unless (3 == 3) {
return 0;
}
my $ret = 3 == 3;
unless ($ret isa int && $ret == 1) {
return 0;
}
return 1;
}
sub numeric_eq_int_different : int () {
if (3 == 2) {
return 0;
}
return 1;
}
sub numeric_eq_long_same : int () {
if ((long)3 == (long)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_eq_long_different : int () {
if ((long)3 == (long)2) {
return 0;
}
else {
return 1;
}
}
sub numeric_eq_float_same : int () {
if (0.5f == 0.5f) {
return 1;
}
else {
return 0;
}
}
sub numeric_eq_float_different : int () {
if (0.5f == 0.25f) {
return 0;
}
else {
return 1;
}
}
sub numeric_eq_double_same : int () {
if (0.5 == 0.5) {
return 1;
}
else {
return 0;
}
}
sub numeric_eq_double_different : int () {
if (0.5 == 0.25) {
return 0;
}
else {
return 1;
}
}
sub numeric_eq_object_same : int () {
my $obj1 = TestCase::Minimal->new;
if ($obj1 == $obj1) {
return 1;
}
else {
return 0;
}
}
sub numeric_eq_object_different : int () {
my $obj1 = TestCase::Minimal->new;
my $obj2 = TestCase::Minimal->new;
if ($obj1 == $obj2) {
return 0;
}
else {
return 1;
}
}
# If a != b
sub numeric_ne_undef : int () {
my $test_case : TestCase::Minimal = TestCase::Minimal->new;
if (undef != undef) {
}
else {
if ($test_case != undef) {
if (undef != $test_case) {
return 1;
}
}
}
return 0;
}
sub numeric_ne_byte_same : int () {
if ((byte)3 != (byte)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_ne_byte_different : int () {
if ((byte)3 != (byte)2) {
return 1;
}
else {
return 0;
}
}
sub numeric_ne_short_same : int () {
if ((int)(short)3 != (int)(short)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_ne_short_different : int () {
if ((int)(short)3 != (int)(short)2) {
return 1;
}
else {
return 0;
}
}
sub numeric_ne_int_same : int () {
if ((int)3 != (int)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_ne_int_different : int () {
if ((int)3 != (int)2) {
return 1;
}
else {
return 0;
}
}
sub numeric_ne_long_same : int () {
if ((long)3 != (long)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_ne_long_different : int () {
if ((long)3 != (long)2) {
return 1;
}
else {
return 0;
}
}
sub numeric_ne_float_same : int () {
if (0.5f != 0.5f) {
return 0;
}
else {
return 1;
}
}
sub numeric_ne_float_different : int () {
if (0.5f != 0.25f) {
return 1;
}
else {
return 0;
}
}
sub numeric_ne_double_same : int () {
if (0.5 != 0.5) {
return 0;
}
else {
return 1;
}
}
sub numeric_ne_double_different : int () {
if (0.5 != 0.25) {
return 1;
}
else {
return 0;
}
}
sub numeric_ne_object_same : int () {
my $obj1 = TestCase::Minimal->new;
if ($obj1 != $obj1) {
return 0;
}
else {
return 1;
}
}
sub numeric_ne_object_different : int () {
my $obj1 = TestCase::Minimal->new;
my $obj2 = TestCase::Minimal->new;
if ($obj1 != $obj2) {
return 1;
}
else {
return 0;
}
}
# If a > b
sub numeric_gt_byte_left_big : int () {
if ((byte)3 > (byte)1) {
return 1;
}
else {
return 0;
}
}
sub numeric_gt_byte_same : int () {
if ((byte)3 > (byte)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_byte_right_big : int () {
if ((byte)3 > (byte)4) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_short_left_big : int () {
if ((int)(short)3 > (int)(short)1) {
return 1;
}
else {
return 0;
}
}
sub numeric_gt_short_same : int () {
if ((int)(short)3 > (int)(short)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_short_right_big : int () {
if ((int)(short)3 > (int)(short)4) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_int_left_big : int () {
if (3 > 1) {
return 1;
}
else {
return 0;
}
}
sub numeric_gt_int_same : int () {
if (3 > 3) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_int_right_big : int () {
if (3 > 4) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_long_left_big : int () {
if ((long)3 > (long)1) {
return 1;
}
else {
return 0;
}
}
sub numeric_gt_long_same : int () {
if ((long)3 > (long)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_long_right_big : int () {
if ((long)3 > (long)4) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_float_left_big : int () {
if ((float)3 > (float)1) {
return 1;
}
else {
return 0;
}
}
sub numeric_gt_float_same : int () {
if ((float)3 > (float)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_float_right_big : int () {
if ((float)3 > (float)4) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_double_left_big : int () {
if ((double)3 > (double)1) {
return 1;
}
else {
return 0;
}
}
sub numeric_gt_double_same : int () {
if ((double)3 > (double)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_gt_double_right_big : int () {
if ((double)3 > (double)4) {
return 0;
}
else {
return 1;
}
}
# If a >= b
sub numeric_ge_byte_left_big : int () {
if ((byte)3 >= (byte)1) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_byte_same : int () {
if ((byte)3 >= (byte)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_byte_right_big : int () {
if ((byte)3 >= (byte)4) {
return 0;
}
else {
return 1;
}
}
sub numeric_ge_short_left_big : int () {
if ((int)(short)3 >= (int)(short)1) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_short_same : int () {
if ((int)(short)3 >= (int)(short)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_short_right_big : int () {
if ((int)(short)3 >= (int)(short)4) {
return 0;
}
else {
return 1;
}
}
sub numeric_ge_int_left_big : int () {
if (3 >= 1) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_int_same : int () {
if (3 >= 3) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_int_right_big : int () {
if (3 >= 4) {
return 0;
}
else {
return 1;
}
}
sub numeric_ge_long_left_big : int () {
if ((long)3 >= (long)1) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_long_same : int () {
if ((long)3 >= (long)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_long_right_big : int () {
if ((long)3 >= (long)4) {
return 0;
}
else {
return 1;
}
}
sub numeric_ge_float_left_big : int () {
if ((float)3 >= (float)1) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_float_same : int () {
if ((float)3 >= (float)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_float_right_big : int () {
if ((float)3 >= (float)4) {
return 0;
}
else {
return 1;
}
}
sub numeric_ge_double_left_big : int () {
if ((double)3 >= (double)1) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_double_same : int () {
if ((double)3 >= (double)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_ge_double_right_big : int () {
if ((double)3 >= (double)4) {
return 0;
}
else {
return 1;
}
}
# If a < b
sub numeric_lt_byte_left_big : int () {
if ((byte)3 < (byte)1) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_byte_same : int () {
if ((byte)3 < (byte)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_byte_right_big : int () {
if ((byte)3 < (byte)4) {
return 1;
}
else {
return 0;
}
}
sub numeric_lt_short_left_big : int () {
if ((int)(short)3 < (int)(short)1) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_short_same : int () {
if ((int)(short)3 < (int)(short)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_short_right_big : int () {
if ((int)(short)3 < (int)(short)4) {
return 1;
}
else {
return 0;
}
}
sub numeric_lt_int_left_big : int () {
if (3 < 1) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_int_same : int () {
if (3 < 3) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_int_right_big : int () {
if (3 < 4) {
return 1;
}
else {
return 0;
}
}
sub numeric_lt_long_left_big : int () {
if ((long)3 < (long)1) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_long_same : int () {
if ((long)3 < (long)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_long_right_big : int () {
if ((long)3 < (long)4) {
return 1;
}
else {
return 0;
}
}
sub numeric_lt_float_left_big : int () {
if ((float)3 < (float)1) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_float_same : int () {
if ((float)3 < (float)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_float_right_big : int () {
if ((float)3 < (float)4) {
return 1;
}
else {
return 0;
}
}
sub numeric_lt_double_left_big : int () {
if ((double)3 < (double)1) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_double_same : int () {
if ((double)3 < (double)3) {
return 0;
}
else {
return 1;
}
}
sub numeric_lt_double_right_big : int () {
if ((double)3 < (double)4) {
return 1;
}
else {
return 0;
}
}
# If a <= b
sub numeric_le_byte_left_big : int () {
if ((byte)3 <= (byte)1) {
return 0;
}
else {
return 1;
}
}
sub numeric_le_byte_same : int () {
if ((byte)3 <= (byte)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_byte_right_big : int () {
if ((byte)3 <= (byte)4) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_short_left_big : int () {
if ((int)(short)3 <= (int)(short)1) {
return 0;
}
else {
return 1;
}
}
sub numeric_le_short_same : int () {
if ((int)(short)3 <= (int)(short)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_short_right_big : int () {
if ((int)(short)3 <= (int)(short)4) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_int_left_big : int () {
if (3 <= 1) {
return 0;
}
else {
return 1;
}
}
sub numeric_le_int_same : int () {
if (3 <= 3) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_int_right_big : int () {
if (3 <= 4) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_long_left_big : int () {
if ((long)3 <= (long)1) {
return 0;
}
else {
return 1;
}
}
sub numeric_le_long_same : int () {
if ((long)3 <= (long)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_long_right_big : int () {
if ((long)3 <= (long)4) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_float_left_big : int () {
if ((float)3 <= (float)1) {
return 0;
}
else {
return 1;
}
}
sub numeric_le_float_same : int () {
if ((float)3 <= (float)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_float_right_big : int () {
if ((float)3 <= (float)4) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_double_left_big : int () {
if ((double)3 <= (double)1) {
return 0;
}
else {
return 1;
}
}
sub numeric_le_double_same : int () {
if ((double)3 <= (double)3) {
return 1;
}
else {
return 0;
}
}
sub numeric_le_double_right_big : int () {
if ((double)3 <= (double)4) {
return 1;
}
else {
return 0;
}
}
}