class TestCase::Literal::Character {
  static method character_literal : int () {
    # Character
    {
      my $ch = 'a';
      my $bytes = new byte[1];
      $bytes->[0] = $ch;
      unless ($ch == 97) {
        return 0;
      }
    }
    
    # Escape characters
    {
      my $ch_a = '\a';
      my $ch_t = '\t';
      my $ch_n = '\n';
      my $ch_f = '\f';
      my $ch_r = '\r';
      my $ch_dq = '\"';
      my $ch_q = '\'';
      my $ch_bsh = '\\';

      unless ($ch_a == 7) {
        return 0;
      }
      
      unless ($ch_t == 9) {
        return 0;
      }
      
      unless ($ch_n == 10) {
        return 0;
      }
      
      unless ($ch_f == 12) {
        return 0;
      }

      unless ($ch_r == 13) {
        return 0;
      }
      
      unless ($ch_dq == 34) {
        return 0;
      }
      
      unless ($ch_q == 39) {
        return 0;
      }
      
      unless ($ch_bsh == 92) {
        return 0;
      }
    }
    
    return 1;
  }
  
  static method character_literal_hex : int () {
    # Hexadecimal escape character
    {
      # All hexadecimal numbers
      {
        my $ch00 = '\x00';
        my $ch11 = '\x11';
        my $ch22 = '\x22';
        my $ch33 = '\x33';
        my $ch44 = '\x44';
        my $ch55 = '\x55';
        my $ch66 = '\x66';
        my $ch77 = '\x77';
        my $ch78 = '\x78';
        my $ch79 = '\x79';
        my $ch7a = '\x7a';
        my $ch7b = '\x7b';
        my $ch7c = '\x7c';
        my $ch7d = '\x7d';
        my $ch7e = '\x7e';
        my $ch7f = '\x7f';
        my $ch7A = '\x7A';
        my $ch7B = '\x7B';
        my $ch7C = '\x7C';
        my $ch7D = '\x7D';
        my $ch7E = '\x7E';
        my $ch7F = '\x7F';
        
        unless ($ch00 == 0) {
          return 0;
        }
        
        unless ($ch11 == 17) {
          return 0;
        }
        
        unless ($ch22 == 34) {
          return 0;
        }
        
        unless ($ch33 == 51) {
          return 0;
        }

        unless ($ch44 == 68) {
          return 0;
        }

        unless ($ch55 == 85) {
          return 0;
        }
        
        unless ($ch66 == 102) {
          return 0;
        }
        
        unless ($ch77 == 119) {
          return 0;
        }

        unless ($ch78 == 120) {
          return 0;
        }

        unless ($ch79 == 121) {
          return 0;
        }

        unless ($ch7a == 122) {
          return 0;
        }

        unless ($ch7b == 123) {
          return 0;
        }

        unless ($ch7c == 124) {
          return 0;
        }

        unless ($ch7d == 125) {
          return 0;
        }

        unless ($ch7e == 126) {
          return 0;
        }

        unless ($ch7f == 127) {
          return 0;
        }

        unless ($ch7A == 122) {
          return 0;
        }

        unless ($ch7B == 123) {
          return 0;
        }

        unless ($ch7C == 124) {
          return 0;
        }

        unless ($ch7D == 125) {
          return 0;
        }

        unless ($ch7E == 126) {
          return 0;
        }

        unless ($ch7F == 127) {
          return 0;
        }
      }
      # One hexadecimal number
      {
        unless ('\xa' == '\x0a') {
          return 0;
        }
      }

      # Braces
      {
        unless ('\x0a' == '\x{0a}') {
          return 0;
        }
      }

      # any byte type
      {
        my $byte = '\xFF';
        unless ($byte == -1) {
          return 0;
        }

        unless ($byte == (byte)0xFF) {
          return 0;
        }
      }
    }

    return 1;
  }

  static method character_literal_octal : int () {
    # Octal escape character \000
    {
      unless ('\0' == 0) {
        return 0;
      }
      
      unless ('\00' == 0) {
        return 0;
      }
      
      unless ('\01' == 1) {
        return 0;
      }
      
      unless ('\02' == 2) {
        return 0;
      }

      unless ('\03' == 3) {
        return 0;
      }

      unless ('\04' == 4) {
        return 0;
      }
      
      unless ('\05' == 5) {
        return 0;
      }
      
      unless ('\06' == 6) {
        return 0;
      }

      unless ('\07' == 7) {
        return 0;
      }

      unless ('\000' == 0) {
        return 0;
      }
      
      unless ('\001' == 1) {
        return 0;
      }
      
      unless ('\002' == 2) {
        return 0;
      }

      unless ('\003' == 3) {
        return 0;
      }

      unless ('\004' == 4) {
        return 0;
      }
      
      unless ('\005' == 5) {
        return 0;
      }
      
      unless ('\006' == 6) {
        return 0;
      }

      unless ('\007' == 7) {
        return 0;
      }

      unless ('\377' == -1) {
        return 0;
      }
    }

    # Octal escape character \o{0}
    {
      unless ('\o{0}' == 0) {
        return 0;
      }
      
      unless ('\o{1}' == 1) {
        return 0;
      }
      
      unless ('\o{2}' == 2) {
        return 0;
      }

      unless ('\o{3}' == 3) {
        return 0;
      }

      unless ('\o{4}' == 4) {
        return 0;
      }
      
      unless ('\o{5}' == 5) {
        return 0;
      }
      
      unless ('\o{6}' == 6) {
        return 0;
      }

      unless ('\o{7}' == 7) {
        return 0;
      }

      unless ('\o{00}' == 0) {
        return 0;
      }
      
      unless ('\o{01}' == 1) {
        return 0;
      }
      
      unless ('\o{02}' == 2) {
        return 0;
      }

      unless ('\o{03}' == 3) {
        return 0;
      }

      unless ('\o{04}' == 4) {
        return 0;
      }
      
      unless ('\o{05}' == 5) {
        return 0;
      }
      
      unless ('\o{06}' == 6) {
        return 0;
      }

      unless ('\o{07}' == 7) {
        return 0;
      }

      unless ('\o{77}' == 63) {
        return 0;
      }

      unless ('\o{377}' == -1) {
        return 0;
      }
    }

    return 1;
  }
}
