package TestCase::UnaryPlus {
  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);
  
  sub unary_plus_byte : int () {
    my $value = +(byte)INT8_MAX();
    
    unless ($value isa int) {
      return 0;
    }
    
    unless ($value == INT8_MAX()) {
      return 0;
    }
    
    return 1;
  }

  sub unary_plus_short : int () {
    my $value = +(short)INT16_MAX();
    
    unless ($value isa int) {
      return 0;
    }
    
    unless ($value == INT16_MAX()) {
      return 0;
    }
    
    return 1;
  }
  
  sub unary_plus_int : int () {
    my $value = +INT32_MAX();
    
    unless ($value isa int) {
      return 0;
    }
    
    unless ($value == INT32_MAX()) {
      return 0;
    }
    
    return 1;
  }
  
  sub unary_plus_long : int () {
    my $value = +INT64_MAX();
    
    unless ($value isa long) {
      return 0;
    }
    
    unless ($value == INT64_MAX()) {
      return 0;
    }
    
    return 1;
  }
  
  sub unary_plus_float : int () {
    my $value = +FLT_MAX();
    
    unless ($value isa float) {
      return 0;
    }
    
    unless ($value == FLT_MAX()) {
      return 0;
    }
    
    return 1;
  }
  sub unary_plus_double : int () {
    my $value = +DBL_MAX();
    
    unless ($value isa double) {
      return 0;
    }
    
    unless ($value == DBL_MAX()) {
      return 0;
    }
    
    return 1;
  }
}
