package TestCase::Remainder {
#
# Spec tests
#
sub remainder_byte_byte : int () {
my $total = (byte)7 % (byte)3;
unless ($total == 1) {
return 0;
}
unless ($total isa int) {
return 0;
}
return 1;
}
sub remainder_short_short : int () {
my $total = (short)10 % (short)2;
unless ($total == 0) {
return 0;
}
unless ($total isa int) {
return 0;
}
return 1;
}
sub remainder_int_byte : int () {
my $total = 12 % (byte)5;
unless ($total == 2) {
return 0;
}
unless ($total isa int) {
return 0;
}
return 1;
}
sub remainder_int_short : int () {
my $total = 7 % (short)3;
unless ($total == 1) {
return 0;
}
unless ($total isa int) {
return 0;
}
return 1;
}
sub remainder_byte_int : int () {
my $total = (byte)-5 % 3;
unless ($total == -2) {
return 0;
}
unless ($total isa int) {
return 0;
}
return 1;
}
sub remainder_short_int : int () {
my $total = (short)5 % -3;
unless ($total == 2) {
return 0;
}
unless ($total isa int) {
return 0;
}
return 1;
}
sub remainder_int_int : int () {
my $total1 = 1000000000 % 2;
unless ($total1 == 0) {
return 0;
}
unless ($total1 isa int) {
return 0;
}
return 1;
}
sub remainder_long_long : int () {
my $total1 = 100000000001L % 2L;
unless ($total1 == 1) {
return 0;
}
unless ($total1 isa long) {
return 0;
}
return 1;
}
#
# Optional tests
#
sub remainder : int () {
my $num1 = (byte)((byte)5 % (byte)3);
my $num2 = (byte)((byte)-3 % (byte)5);
my $num3 = (short)((int)(short)5 % (int)(short)3);
my $num4 = (short)((int)(short)-3 % (int)(short)5);
my $num5 = 5 % 3;
my $num6 = -3 % 5;
my $num7 = 5L % 3L;
my $num8 = -3L % 5L;
if ($num1 == 2) {
if ($num2 == -3) {
if ($num3 == 2) {
if ($num4 == -3) {
if ($num5 == 2) {
if ($num6 == -3) {
if ($num7 == 2L) {
if ($num8 == -3L) {
return 1;
}
}
}
}
}
}
}
}
return 0;
}
}