class TestCase::Operator::Exists {
  
  use TestCase::Minimal;
  use TestCase::Simple;
  use TestCase::SimpleChild;
  
  has field_byte : byte;
  has field_short : short;
  has field_int : int;
  has field_long : long;
  has field_float : float;
  has field_double : double;
  has field_object : object;
  has field_undef : object;
  
  has tmp1 : byte;
  has tmp2 : long;
  has tmp3 : byte;
  has tmp4 : float;
  has tmp5 : byte;
  has tmp6 : int;
  has tmp7 : byte;
  has tmp8 : object;
  has tmp9 : short;
  has tmp10 : byte;
  
  static method exists : int () {
    
    {
      my $object = new TestCase::Operator::Exists;
      
      {
        if (exists $object->{field_byte}) {
          return 0;
        }
        
        $object->{field_byte} = 0;
        
        unless (exists $object->{field_byte} == 1) {
          return 0;
        }
      }
      
      {
        if (exists $object->{field_short}) {
          return 0;
        }
        
        $object->{field_short} = 0;
        
        unless (exists $object->{field_short} == 1) {
          return 0;
        }
      }
      
      {
        if (exists $object->{field_int}) {
          return 0;
        }
        
        $object->{field_int} = 0;
        
        unless (exists $object->{field_int} == 1) {
          return 0;
        }
      }
      
      {
        if (exists $object->{field_long}) {
          return 0;
        }
        
        $object->{field_long} = 0;
        
        unless (exists $object->{field_long} == 1) {
          return 0;
        }
      }
      
      {
        if (exists $object->{field_float}) {
          return 0;
        }
        
        $object->{field_float} = 0;
        
        unless (exists $object->{field_float} == 1) {
          return 0;
        }
      }
      
      {
        if (exists $object->{field_double}) {
          return 0;
        }
        
        $object->{field_double} = 0;
        
        unless (exists $object->{field_double} == 1) {
          return 0;
        }
      }
      
      {
        if (exists $object->{field_object}) {
          return 0;
        }
        
        $object->{field_object} = Int->new(1);
        
        unless (exists $object->{field_object} == 1) {
          return 0;
        }
      }
      
      {
        if (exists $object->{field_undef}) {
          return 0;
        }
        
        $object->{field_undef} = undef;
        
        unless (exists $object->{field_undef} == 1) {
          return 0;
        }
      }
      
    }
    
    return 1;
  }
  
  static method inheritance : int () {
    
    my $simple_child = TestCase::SimpleChild->new;
    
    $simple_child->{simple_only} = 1;
    
    unless (exists $simple_child->{simple_only}) {
      return 0;
    }
    
    my $simple = (TestCase::Simple)$simple_child;
    
    unless (exists $simple->{simple_only}) {
      return 0;
    }
    
    return 1;
  }
}