package TestCase::Literal::Integer {
  use SPVM::Util (INT8_MIN, INT8_MAX, INT16_MIN, INT16_MAX, INT32_MIN, INT32_MAX, INT64_MIN, INT64_MAX, FLT_MIN, FLT_MAX, DBL_MIN, DBL_MAX);
  
  # decimal literal
  sub decimal_all_numbers : int () {
    my $all_numbers = 1234567890;
    unless ($all_numbers == 1234567889 + 1) {
      return 0;
    }
    return 1;
  }
  sub decimal_plus_max : int () {
    my $plus_max = +2147483647;
    unless ($plus_max == 2147483647) {
      return 0;
    }
    return 1;
  }
  sub decimal_minus_max : int () {
    my $minus_max = -2147483648;
    unless ($minus_max == -2147483647 - 1) {
      return 0;
    }
    return 1;
  }
  sub decimal_underline : int () {
    my $underline = 123_456__789;
    unless ($underline == 123456789) {
      return 0;
    }
    return 1;
  }
  sub decimal_long_minus_max : int () {
    my $long_minus_max = -9223372036854775808L;
    unless ($long_minus_max == -9223372036854775807L - 1L) {
      return 0;
    }
    return 1;
  }
  sub decimal_long_lower_case : int () {
    my $long_lower_case = 4l;
    unless ($long_lower_case == 4L) {
      return 0;
    }
    return 1;
  }
  sub decimal_long_underline : int () {
    my $long_underline = 123_456L;
    unless ($long_underline == 123456L) {
      return 0;
    }
    return 1;
  }
  sub decimal_byte_norrowing_convertion : int () {
    my $byte_norrowing_convertion : byte = -128;
    unless ($byte_norrowing_convertion == -128) {
      return 0;
    }
    return 1;
  }
  sub decimal_short_norrowing_convertion : int () {
    my $short_norrowing_convertion : short = -32768;
    unless ($short_norrowing_convertion == -32768) {
      return 0;
    }
    return 1;
  }
  
  # hex
  sub hex_all_numbers : int () {
    my $all_numbers1 = 0x01234567;
    my $all_numbers2 = 0x00890000;
    my $all_numbers3 = 0x00ABCDEF;
    my $all_numbers4 = 0x00abcdef;
    unless ($all_numbers1 == 19088743) {
      return 0;
    }
    unless ($all_numbers2 == 8978432) {
      return 0;
    }
    unless ($all_numbers3 == 11259375) {
      return 0;
    }
    unless ($all_numbers4 == 11259375) {
      return 0;
    }
    return 1;
  }
  sub hex_all_f : int () {
    my $all_f = 0xFFFFFFFF;
    unless ($all_f == -1) {
      return 0;
    }
    return 1;
  }
  sub hex_max_int : int () {
    my $max_int = 0x7FFFFFFF;
    unless ($max_int == INT32_MAX()) {
      return 0;
    }
    return 1;
  }
  sub hex_min_int : int () {
    my $min_int = 0x80000000;
    unless ($min_int == INT32_MIN()) {
      return 0;
    }
    return 1;
  }
  sub hex_combination : int () {
    my $combination = -0x000000FF_FFFFFFFFL;
    unless ($combination == -1099511627775L) {
      return 0;
    }
    return 1;
  }
  sub hex_long_all_f : int () {
    my $long_all_f = 0xFFFFFFFF_FFFFFFFFL;
    unless ($long_all_f == -1L) {
      return 0;
    }
    return 1;
  }
  
  # octal
  sub octal_all_numbers : int () {
    my $all_numbers = 012345670;
    unless ($all_numbers == 2739128) {
      return 0;
    }
    return 1;
  }
  sub octal_combination : int () {
    my $combination = -0777_777777777777777777L;
    unless ($combination == -9223372036854775807L) {
      return 0;
    }
    return 1;
  }
  
  # binary
  sub binary_all_numbers : int () {
    my $all_numbers = 0b10101010;
    unless ($all_numbers == 170) {
      return 0;
    }
    return 1;
  }
  sub binary_combination : int () {
    my $combination = -0b11111111_1111111111111111111111111111111111111111111111111111111L;
    unless ($combination == -9223372036854775807L) {
      return 0;
    }
    
    return 1;
  }
}
