package TestCase::While {
  use TestCase::Minimal;

  sub condition_my_var_mem_id : int () {
    while (my $uchar = 5) {
      my $is_char = 10;

      my $num = 1;
      
      unless ($uchar == 5) {
        return 0;
      }
      last;
    }
    
    while (my $uchar = 5) {
      my $is_char = 10;

      my $num = [1];
      
      unless ($uchar == 5) {
        return 0;
      }
      
      $uchar;
      
      last;
    }
    
    return 1;
  }
  
  sub basic : int () {
  
    my $success_while = 0;
    {
      my $total = 0;
      my $i = 0;
      while ($i <= 3) {
        $total = $total + $i;
        $i++;
      }
      
      if ($total == 6) {
        $success_while = 1;
      }
    }
    
    unless ($success_while) {
      return 0;
    }
    
    return 1;
  }
  
  sub next : int () {
    
    my $i = 0;
    my $total = 0;
    while ($i < 5) {
      
      if ($i == 3) {
        $i++;
        next;
      }
      
      $total += $i;
      
      $i++;
    }
    
    unless ($total == 7) {
      return 0;
    }
    
    return 1;
  }

  sub last : int () {
    
    my $i = 0;
    my $total = 0;
    while ($i < 5) {
      
      if ($i == 3) {
        last;
      }
      
      $total += $i;
      
      $i++;
    }
    
    unless ($total == 3) {
      return 0;
    }
    
    return 1;
  }

  sub condition_my : int () {
    
    my $num = 5;
    while (my $num = 3) {
      if ($num == 3) {
        return 1;
      }
      else {
        return 0;
      }
    }
    return 0;
  }
}
