public void numeric_case111()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      Token token;
      Token token1;
      byte[] bs = new byte[3];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[3];
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 1;
      characterStream.stream = bs1;
      byte[] bs2 = new byte[3];
      token = new Token();
      token.token_string = bs2;
      token.token_id = 0;
      TokenStream s0 = new TokenStream();
      s0.ch_stream = characterStream;
      byte[] bs3 = new byte[3];
      token1 = this.numeric_case(s0, token, (byte)49, bs3, 1);
      disposables.Dispose();
      Assert.IsNotNull((object)token1);
      Assert.IsNotNull((object)(token1.token_string));
      Assert.AreEqual<int>(3, token1.token_string.Length);
      Assert.AreEqual<byte>((byte)0, token1.token_string[0]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[1]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[2]);
      Assert.AreEqual<int>(-1, token1.token_id);
    }
}
 public byte get_char(CharacterStream stream_ptr)
 {
     PexAssume.IsNotNull(stream_ptr);
     PexAssume.IsNotNull(stream_ptr.fp);
     PexAssume.IsNotNullOrEmpty(stream_ptr.stream);
     PexAssume.IsTrue(stream_ptr.stream_ind < stream_ptr.stream.Length);
     PexAssume.IsTrue(stream_ptr.stream_ind >= 0);
     PexAssume.IsTrue(stream_ptr.stream.Length > 1);
     byte result = Original.get_char(stream_ptr);
     return result;
     // TODO: add assertions to method OriginalTest.get_char(CharacterStream)
 }
public void unget_char838()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      byte[] bs = new byte[3];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[3];
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 2;
      characterStream.stream = bs1;
      this.unget_char((byte)0, characterStream);
      disposables.Dispose();
    }
}
public void skip320()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      byte[] bs = new byte[2];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[2];
      bs1[1] = (byte)127;
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 0;
      characterStream.stream = bs1;
      this.skip(characterStream);
      disposables.Dispose();
    }
}
public void get_char210()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      byte b;
      byte[] bs = new byte[80];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[80];
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 0;
      characterStream.stream = bs1;
      b = this.get_char(characterStream);
      disposables.Dispose();
      Assert.AreEqual<byte>((byte)0, b);
    }
}
 public void unget_char(byte ch, CharacterStream stream_ptr)
 {
     PexAssume.IsNotNull(stream_ptr);
     PexAssume.IsNotNull(stream_ptr.fp);
     PexAssume.IsNotNullOrEmpty(stream_ptr.stream);
     PexAssume.IsTrue(stream_ptr.stream_ind > 0 && stream_ptr.stream_ind < stream_ptr.stream.Length);
     Original.unget_char(ch, stream_ptr);
     // TODO: add assertions to method OriginalTest.unget_char(Byte, CharacterStream)
 }
 public void skip(CharacterStream stream_ptr)
 {
     PexAssume.IsNotNull(stream_ptr);
     PexAssume.IsNotNull(stream_ptr.fp);
     PexAssume.IsNotNullOrEmpty(stream_ptr.stream);
     PexAssume.IsTrue(stream_ptr.stream_ind >= 0 && stream_ptr.stream_ind < stream_ptr.stream.Length);
     PexAssume.IsTrue(stream_ptr.stream.Length > 1);
     PexAssume.IsTrue(stream_ptr.stream[stream_ptr.stream.Length - 1] == 127);
     Original.skip(stream_ptr);
     // TODO: add assertions to method OriginalTest.skip(CharacterStream)f
 }
        /* **********************************************************************
           Function name : skip
           Input         : character_stream
           Output        : void.
           Exceptions    : none.
           Description   : This function skips the comment part of the program.
                           It takes charcter_stream as input and reads character
                           until it finds new line character or
                           end_of_character_stream.                   
         * ******************************************************************* */

        public static void skip(CharacterStream stream_ptr)
        {
            byte c;

            while ((c = get_char(stream_ptr)) != '\n' &&
                   is_end_of_character_stream(stream_ptr) == FALSE)
                ; /* Skip the characters until EOF or EOL found. */
            if (c == (byte)EOF) unget_char(c, stream_ptr); /* Put back to leave gracefully - hf */
            return;
        }
        /* *******************************************************************
           Function name : is_end_of_character_stream.
           Input         : character_stream.
           Output        : Boolean value.
           Description   : This function checks whether it is end of character
                           stream or not. It returns BOOLEANvariable which is 
                           true or false. The function checks whether the last 
                           read character is end file character or not and
                           returns the value according to it.
         * ****************************************************************** */

        static int is_end_of_character_stream(CharacterStream stream_ptr)
        {
            if (stream_ptr.fp.Length == stream_ptr.fp.Position && stream_ptr.stream[stream_ptr.stream_ind - 1] == EOF)
            {
                return (TRUE);
            }
            else
                return (FALSE);
        }
public void numeric_caseThrowsIndexOutOfRangeException651()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      Token token;
      Token token1;
      byte[] bs = new byte[0];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[80];
      bs1[0] = (byte)49;
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 3;
      characterStream.stream = bs1;
      byte[] bs2 = new byte[3];
      token = new Token();
      token.token_string = bs2;
      token.token_id = 0;
      TokenStream s0 = new TokenStream();
      s0.ch_stream = characterStream;
      byte[] bs3 = new byte[3];
      token1 = this.numeric_case(s0, token, (byte)49, bs3, 1);
      disposables.Dispose();
    }
}
public void get_token604()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      Token token;
      byte[] bs = new byte[8];
      bs[0] = (byte)32;
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[82];
      bs1[1] = (byte)127;
      bs1[2] = (byte)127;
      bs1[3] = (byte)127;
      bs1[4] = (byte)127;
      bs1[5] = (byte)127;
      bs1[6] = (byte)127;
      bs1[7] = (byte)127;
      bs1[8] = (byte)127;
      bs1[9] = (byte)127;
      bs1[10] = (byte)127;
      bs1[11] = (byte)127;
      bs1[12] = (byte)127;
      bs1[13] = (byte)127;
      bs1[14] = (byte)127;
      bs1[15] = (byte)127;
      bs1[16] = (byte)127;
      bs1[17] = (byte)127;
      bs1[18] = (byte)127;
      bs1[19] = (byte)127;
      bs1[20] = (byte)127;
      bs1[21] = (byte)127;
      bs1[22] = (byte)127;
      bs1[23] = (byte)127;
      bs1[24] = (byte)127;
      bs1[25] = (byte)127;
      bs1[26] = (byte)127;
      bs1[27] = (byte)127;
      bs1[28] = (byte)127;
      bs1[29] = (byte)127;
      bs1[30] = (byte)127;
      bs1[31] = (byte)127;
      bs1[32] = (byte)127;
      bs1[33] = (byte)127;
      bs1[34] = (byte)127;
      bs1[35] = (byte)127;
      bs1[36] = (byte)127;
      bs1[37] = (byte)127;
      bs1[38] = (byte)127;
      bs1[39] = (byte)127;
      bs1[40] = (byte)127;
      bs1[41] = (byte)127;
      bs1[42] = (byte)127;
      bs1[43] = (byte)127;
      bs1[44] = (byte)127;
      bs1[45] = (byte)127;
      bs1[46] = (byte)127;
      bs1[47] = (byte)127;
      bs1[48] = (byte)127;
      bs1[49] = (byte)127;
      bs1[50] = (byte)127;
      bs1[51] = (byte)127;
      bs1[52] = (byte)127;
      bs1[53] = (byte)127;
      bs1[54] = (byte)127;
      bs1[55] = (byte)127;
      bs1[56] = (byte)127;
      bs1[57] = (byte)127;
      bs1[58] = (byte)127;
      bs1[59] = (byte)127;
      bs1[60] = (byte)127;
      bs1[61] = (byte)127;
      bs1[62] = (byte)127;
      bs1[63] = (byte)127;
      bs1[64] = (byte)127;
      bs1[65] = (byte)127;
      bs1[66] = (byte)127;
      bs1[67] = (byte)127;
      bs1[68] = (byte)127;
      bs1[69] = (byte)127;
      bs1[70] = (byte)127;
      bs1[71] = (byte)127;
      bs1[72] = (byte)127;
      bs1[73] = (byte)127;
      bs1[74] = (byte)127;
      bs1[75] = (byte)127;
      bs1[76] = (byte)127;
      bs1[77] = (byte)127;
      bs1[78] = (byte)127;
      bs1[79] = (byte)127;
      bs1[80] = (byte)127;
      bs1[81] = (byte)127;
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 0;
      characterStream.stream = bs1;
      TokenStream s0 = new TokenStream();
      s0.ch_stream = characterStream;
      token = this.get_token(s0);
      disposables.Dispose();
    }
}
public void get_token773()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      Token token;
      byte[] bs = new byte[64];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[64];
      bs1[0] = (byte)10;
      bs1[1] = (byte)12;
      bs1[2] = (byte)1;
      bs1[3] = (byte)1;
      bs1[4] = (byte)1;
      bs1[5] = (byte)1;
      bs1[6] = (byte)1;
      bs1[7] = (byte)1;
      bs1[8] = (byte)1;
      bs1[9] = (byte)1;
      bs1[10] = (byte)1;
      bs1[11] = (byte)1;
      bs1[12] = (byte)1;
      bs1[13] = (byte)1;
      bs1[14] = (byte)1;
      bs1[15] = (byte)1;
      bs1[16] = (byte)1;
      bs1[17] = (byte)1;
      bs1[18] = (byte)1;
      bs1[19] = (byte)1;
      bs1[20] = (byte)1;
      bs1[21] = (byte)1;
      bs1[22] = (byte)1;
      bs1[23] = (byte)1;
      bs1[24] = (byte)1;
      bs1[25] = (byte)1;
      bs1[26] = (byte)1;
      bs1[27] = (byte)1;
      bs1[28] = (byte)1;
      bs1[29] = (byte)1;
      bs1[30] = (byte)1;
      bs1[31] = (byte)1;
      bs1[32] = (byte)1;
      bs1[33] = (byte)1;
      bs1[34] = (byte)1;
      bs1[35] = (byte)1;
      bs1[36] = (byte)1;
      bs1[37] = (byte)1;
      bs1[38] = (byte)1;
      bs1[39] = (byte)1;
      bs1[40] = (byte)1;
      bs1[41] = (byte)1;
      bs1[42] = (byte)1;
      bs1[43] = (byte)1;
      bs1[44] = (byte)1;
      bs1[45] = (byte)1;
      bs1[46] = (byte)1;
      bs1[47] = (byte)1;
      bs1[48] = (byte)1;
      bs1[49] = (byte)1;
      bs1[50] = (byte)1;
      bs1[51] = (byte)1;
      bs1[52] = (byte)1;
      bs1[53] = (byte)1;
      bs1[54] = (byte)1;
      bs1[55] = (byte)1;
      bs1[56] = (byte)1;
      bs1[57] = (byte)1;
      bs1[58] = (byte)1;
      bs1[59] = (byte)1;
      bs1[60] = (byte)1;
      bs1[61] = (byte)1;
      bs1[62] = (byte)1;
      bs1[63] = (byte)127;
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 0;
      characterStream.stream = bs1;
      TokenStream s0 = new TokenStream();
      s0.ch_stream = characterStream;
      token = this.get_token(s0);
      disposables.Dispose();
      Assert.IsNotNull((object)token);
      Assert.IsNotNull((object)(token.token_string));
      Assert.AreEqual<int>(80, token.token_string.Length);
      Assert.AreEqual<byte>((byte)0, token.token_string[0]);
      Assert.AreEqual<byte>((byte)12, token.token_string[1]);
      Assert.AreEqual<byte>((byte)0, token.token_string[2]);
      Assert.AreEqual<byte>((byte)0, token.token_string[3]);
      Assert.AreEqual<byte>((byte)0, token.token_string[4]);
      Assert.AreEqual<byte>((byte)0, token.token_string[5]);
      Assert.AreEqual<byte>((byte)0, token.token_string[6]);
      Assert.AreEqual<byte>((byte)0, token.token_string[7]);
      Assert.AreEqual<byte>((byte)0, token.token_string[8]);
      Assert.AreEqual<byte>((byte)0, token.token_string[9]);
      Assert.AreEqual<byte>((byte)0, token.token_string[10]);
      Assert.AreEqual<byte>((byte)0, token.token_string[11]);
      Assert.AreEqual<byte>((byte)0, token.token_string[12]);
      Assert.AreEqual<byte>((byte)0, token.token_string[13]);
      Assert.AreEqual<byte>((byte)0, token.token_string[14]);
      Assert.AreEqual<byte>((byte)0, token.token_string[15]);
      Assert.AreEqual<byte>((byte)0, token.token_string[16]);
      Assert.AreEqual<byte>((byte)0, token.token_string[17]);
      Assert.AreEqual<byte>((byte)0, token.token_string[18]);
      Assert.AreEqual<byte>((byte)0, token.token_string[19]);
      Assert.AreEqual<byte>((byte)0, token.token_string[20]);
      Assert.AreEqual<byte>((byte)0, token.token_string[21]);
      Assert.AreEqual<byte>((byte)0, token.token_string[22]);
      Assert.AreEqual<byte>((byte)0, token.token_string[23]);
      Assert.AreEqual<byte>((byte)0, token.token_string[24]);
      Assert.AreEqual<byte>((byte)0, token.token_string[25]);
      Assert.AreEqual<byte>((byte)0, token.token_string[26]);
      Assert.AreEqual<byte>((byte)0, token.token_string[27]);
      Assert.AreEqual<byte>((byte)0, token.token_string[28]);
      Assert.AreEqual<byte>((byte)0, token.token_string[29]);
      Assert.AreEqual<byte>((byte)0, token.token_string[30]);
      Assert.AreEqual<byte>((byte)0, token.token_string[31]);
      Assert.AreEqual<byte>((byte)0, token.token_string[32]);
      Assert.AreEqual<byte>((byte)0, token.token_string[33]);
      Assert.AreEqual<byte>((byte)0, token.token_string[34]);
      Assert.AreEqual<byte>((byte)0, token.token_string[35]);
      Assert.AreEqual<byte>((byte)0, token.token_string[36]);
      Assert.AreEqual<byte>((byte)0, token.token_string[37]);
      Assert.AreEqual<byte>((byte)0, token.token_string[38]);
      Assert.AreEqual<byte>((byte)0, token.token_string[39]);
      Assert.AreEqual<byte>((byte)0, token.token_string[40]);
      Assert.AreEqual<byte>((byte)0, token.token_string[41]);
      Assert.AreEqual<byte>((byte)0, token.token_string[42]);
      Assert.AreEqual<byte>((byte)0, token.token_string[43]);
      Assert.AreEqual<byte>((byte)0, token.token_string[44]);
      Assert.AreEqual<byte>((byte)0, token.token_string[45]);
      Assert.AreEqual<byte>((byte)0, token.token_string[46]);
      Assert.AreEqual<byte>((byte)0, token.token_string[47]);
      Assert.AreEqual<byte>((byte)0, token.token_string[48]);
      Assert.AreEqual<byte>((byte)0, token.token_string[49]);
      Assert.AreEqual<byte>((byte)0, token.token_string[50]);
      Assert.AreEqual<byte>((byte)0, token.token_string[51]);
      Assert.AreEqual<byte>((byte)0, token.token_string[52]);
      Assert.AreEqual<byte>((byte)0, token.token_string[53]);
      Assert.AreEqual<byte>((byte)0, token.token_string[54]);
      Assert.AreEqual<byte>((byte)0, token.token_string[55]);
      Assert.AreEqual<byte>((byte)0, token.token_string[56]);
      Assert.AreEqual<byte>((byte)0, token.token_string[57]);
      Assert.AreEqual<byte>((byte)0, token.token_string[58]);
      Assert.AreEqual<byte>((byte)0, token.token_string[59]);
      Assert.AreEqual<byte>((byte)0, token.token_string[60]);
      Assert.AreEqual<byte>((byte)0, token.token_string[61]);
      Assert.AreEqual<byte>((byte)0, token.token_string[62]);
      Assert.AreEqual<byte>((byte)0, token.token_string[63]);
      Assert.AreEqual<byte>((byte)0, token.token_string[64]);
      Assert.AreEqual<byte>((byte)0, token.token_string[65]);
      Assert.AreEqual<byte>((byte)0, token.token_string[66]);
      Assert.AreEqual<byte>((byte)0, token.token_string[67]);
      Assert.AreEqual<byte>((byte)0, token.token_string[68]);
      Assert.AreEqual<byte>((byte)0, token.token_string[69]);
      Assert.AreEqual<byte>((byte)0, token.token_string[70]);
      Assert.AreEqual<byte>((byte)0, token.token_string[71]);
      Assert.AreEqual<byte>((byte)0, token.token_string[72]);
      Assert.AreEqual<byte>((byte)0, token.token_string[73]);
      Assert.AreEqual<byte>((byte)0, token.token_string[74]);
      Assert.AreEqual<byte>((byte)0, token.token_string[75]);
      Assert.AreEqual<byte>((byte)0, token.token_string[76]);
      Assert.AreEqual<byte>((byte)0, token.token_string[77]);
      Assert.AreEqual<byte>((byte)0, token.token_string[78]);
      Assert.AreEqual<byte>((byte)0, token.token_string[79]);
      Assert.AreEqual<int>(-1, token.token_id);
    }
}
public void get_tokenThrowsIndexOutOfRangeException588()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      Token token;
      byte[] bs = new byte[14];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[14];
      bs1[0] = (byte)10;
      bs1[13] = (byte)127;
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 0;
      characterStream.stream = bs1;
      TokenStream s0 = new TokenStream();
      s0.ch_stream = characterStream;
      token = this.get_token(s0);
      disposables.Dispose();
    }
}
public void skip156()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      byte[] bs = new byte[102];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[96];
      bs1[0] = (byte)127;
      bs1[2] = (byte)127;
      bs1[3] = (byte)127;
      bs1[4] = (byte)127;
      bs1[5] = (byte)127;
      bs1[6] = (byte)127;
      bs1[7] = (byte)127;
      bs1[8] = (byte)127;
      bs1[9] = (byte)127;
      bs1[10] = (byte)127;
      bs1[11] = (byte)127;
      bs1[12] = (byte)127;
      bs1[13] = (byte)127;
      bs1[14] = (byte)127;
      bs1[15] = (byte)127;
      bs1[16] = (byte)127;
      bs1[17] = (byte)127;
      bs1[18] = (byte)127;
      bs1[19] = (byte)127;
      bs1[20] = (byte)127;
      bs1[21] = (byte)127;
      bs1[22] = (byte)127;
      bs1[23] = (byte)127;
      bs1[24] = (byte)127;
      bs1[25] = (byte)127;
      bs1[26] = (byte)127;
      bs1[27] = (byte)127;
      bs1[28] = (byte)127;
      bs1[29] = (byte)127;
      bs1[30] = (byte)127;
      bs1[31] = (byte)127;
      bs1[32] = (byte)127;
      bs1[33] = (byte)127;
      bs1[34] = (byte)127;
      bs1[35] = (byte)127;
      bs1[36] = (byte)127;
      bs1[37] = (byte)127;
      bs1[38] = (byte)127;
      bs1[39] = (byte)127;
      bs1[40] = (byte)127;
      bs1[41] = (byte)127;
      bs1[42] = (byte)127;
      bs1[43] = (byte)127;
      bs1[44] = (byte)127;
      bs1[45] = (byte)127;
      bs1[46] = (byte)127;
      bs1[47] = (byte)127;
      bs1[48] = (byte)127;
      bs1[49] = (byte)127;
      bs1[50] = (byte)127;
      bs1[51] = (byte)127;
      bs1[52] = (byte)127;
      bs1[53] = (byte)127;
      bs1[54] = (byte)127;
      bs1[55] = (byte)127;
      bs1[56] = (byte)127;
      bs1[57] = (byte)127;
      bs1[58] = (byte)127;
      bs1[59] = (byte)127;
      bs1[60] = (byte)127;
      bs1[61] = (byte)127;
      bs1[62] = (byte)127;
      bs1[63] = (byte)127;
      bs1[64] = (byte)127;
      bs1[65] = (byte)127;
      bs1[66] = (byte)127;
      bs1[67] = (byte)127;
      bs1[68] = (byte)127;
      bs1[69] = (byte)127;
      bs1[70] = (byte)127;
      bs1[71] = (byte)127;
      bs1[72] = (byte)127;
      bs1[73] = (byte)127;
      bs1[74] = (byte)127;
      bs1[75] = (byte)127;
      bs1[76] = (byte)127;
      bs1[77] = (byte)127;
      bs1[78] = (byte)127;
      bs1[79] = (byte)127;
      bs1[80] = (byte)127;
      bs1[81] = (byte)127;
      bs1[82] = (byte)127;
      bs1[83] = (byte)127;
      bs1[84] = (byte)127;
      bs1[85] = (byte)127;
      bs1[86] = (byte)127;
      bs1[87] = (byte)127;
      bs1[88] = (byte)127;
      bs1[89] = (byte)127;
      bs1[90] = (byte)127;
      bs1[91] = (byte)127;
      bs1[92] = (byte)127;
      bs1[93] = (byte)127;
      bs1[94] = (byte)127;
      bs1[95] = (byte)127;
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 1;
      characterStream.stream = bs1;
      this.skip(characterStream);
      disposables.Dispose();
    }
}
        /* *********************************************************************
               Function name : open_character_stream
               Input         : filename 
               Output        : charactre stream.
               Exceptions    : If file name doesn't exists it will
                               exit from the program.
               Description   : The function first allocates the memory for 
                               the structure and initilizes it. The constant
                               START gives the first character available in
                               the stream. It ckecks whether the filename is
                               empty string. If it is it assigns file pointer
                               to stdin else it opens the respective file as input.                   
         * * ******************************************************************* */

        public static CharacterStream open_character_stream(String filename)
        {
            CharacterStream stream_ptr = new CharacterStream();
            stream_ptr.stream_ind = START;
            stream_ptr.stream[START] = (byte)'\0';
            if (filename == null)
            {
                string input = Console.In.ReadToEnd();
                stream_ptr.fp = new MemoryStream(new System.Text.UTF8Encoding().GetBytes(input));
            }
            else 
            {
                try
                {
                    if ((stream_ptr.fp = new FileStream(filename, FileMode.Open, FileAccess.Read)) == null)
                    {
                        Console.Write("The file %s doesn't exists\n", filename);
                        System.Environment.Exit(0);
                    }
                }
                catch (DirectoryNotFoundException e)
                {
                    Console.Write("The file " + filename + " doesn't exists\n");
                    System.Environment.Exit(0);
                }
                catch (FileNotFoundException e)
                {
                    Console.Write("The file " + filename + " doesn't exists\n");
                    System.Environment.Exit(0);
                }
            }
            return (stream_ptr);
        }
        /* *********************************************************************
           Function name : get_char
           Input         : charcter_stream.
           Output        : character.
           Exceptions    : None.
           Description   : This function takes character_stream type variable 
                           as input and returns one character. If the stream is
                           empty then it reads the next line from the file and
                           returns the character.       
         * ****************************************************************** */

        public static byte get_char(CharacterStream stream_ptr)
        {
            if (stream_ptr.stream_ind == stream_ptr.stream.Length || stream_ptr.stream[stream_ptr.stream_ind] == '\0')
            {
                try
                {
                    int ind = stream_ptr.fp.Read(stream_ptr.stream, START, 80 - START);
                    stream_ptr.num_read += 80 - START;
                    if (stream_ptr.num_read > stream_ptr.fp.Length)
                        stream_ptr.stream[ind] = EOF;
                }
                catch (ArgumentException e)
                {
                    stream_ptr.stream[START] = (byte)EOF; //no EOF in C#
                }

                stream_ptr.stream_ind = START;
            }
            return (stream_ptr.stream[(stream_ptr.stream_ind)++]);
        }
public void numeric_case948()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      Token token;
      Token token1;
      byte[] bs = new byte[64];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[80];
      bs1[2] = (byte)66;
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 2;
      characterStream.stream = bs1;
      byte[] bs2 = new byte[34];
      token = new Token();
      token.token_string = bs2;
      token.token_id = 0;
      TokenStream s0 = new TokenStream();
      s0.ch_stream = characterStream;
      byte[] bs3 = new byte[33];
      bs3[0] = (byte)9;
      token1 = this.numeric_case(s0, token, (byte)113, bs3, 1);
      disposables.Dispose();
      Assert.IsNotNull((object)token1);
      Assert.IsNotNull((object)(token1.token_string));
      Assert.AreEqual<int>(34, token1.token_string.Length);
      Assert.AreEqual<byte>((byte)66, token1.token_string[0]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[1]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[2]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[3]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[4]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[5]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[6]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[7]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[8]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[9]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[10]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[11]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[12]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[13]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[14]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[15]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[16]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[17]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[18]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[19]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[20]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[21]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[22]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[23]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[24]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[25]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[26]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[27]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[28]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[29]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[30]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[31]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[32]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[33]);
      Assert.AreEqual<int>(-1, token1.token_id);
    }
}
        /* *********************************************************************
           Function name : unget_char
           Input         : character,character_stream.
           Output        : void.
           Description   : This function adds the character ch to the stream. 
                           This is accomplished by decrementing the stream_ind
                           and storing it in the stream. If it is not possible
                           to unget the character then it returns
         * ******************************************************************* */

        public static void unget_char(byte ch, CharacterStream stream_ptr)
        {
            if (stream_ptr.stream_ind == 0)
                return;
            else
                stream_ptr.stream[--(stream_ptr.stream_ind)] = ch;
            return;
        }
public void numeric_case226()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      Token token;
      Token token1;
      byte[] bs = new byte[96];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[80];
      bs1[64] = (byte)49;
      bs1[65] = (byte)1;
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 64;
      characterStream.stream = bs1;
      byte[] bs2 = new byte[96];
      token = new Token();
      token.token_string = bs2;
      token.token_id = 0;
      TokenStream s0 = new TokenStream();
      s0.ch_stream = characterStream;
      token1 = this.numeric_case(s0, token, (byte)49, bs1, 1);
      disposables.Dispose();
      Assert.IsNotNull((object)token1);
      Assert.IsNotNull((object)(token1.token_string));
      Assert.AreEqual<int>(96, token1.token_string.Length);
      Assert.AreEqual<byte>((byte)0, token1.token_string[0]);
      Assert.AreEqual<byte>((byte)49, token1.token_string[1]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[2]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[3]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[4]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[5]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[6]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[7]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[8]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[9]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[10]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[11]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[12]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[13]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[14]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[15]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[16]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[17]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[18]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[19]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[20]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[21]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[22]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[23]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[24]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[25]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[26]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[27]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[28]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[29]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[30]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[31]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[32]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[33]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[34]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[35]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[36]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[37]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[38]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[39]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[40]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[41]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[42]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[43]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[44]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[45]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[46]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[47]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[48]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[49]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[50]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[51]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[52]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[53]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[54]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[55]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[56]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[57]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[58]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[59]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[60]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[61]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[62]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[63]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[64]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[65]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[66]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[67]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[68]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[69]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[70]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[71]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[72]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[73]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[74]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[75]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[76]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[77]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[78]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[79]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[80]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[81]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[82]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[83]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[84]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[85]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[86]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[87]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[88]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[89]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[90]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[91]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[92]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[93]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[94]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[95]);
      Assert.AreEqual<int>(-1, token1.token_id);
    }
}
 public CharacterStream Constructor()
 {
     CharacterStream target = new CharacterStream();
     return target;
     // TODO: add assertions to method CharacterStreamTest.Constructor()
 }
public void error_or_eof_case809()
{
    using (PexDisposableContext disposables = PexDisposableContext.Create())
    {
      MemoryStream memoryStream;
      CharacterStream characterStream;
      Token token;
      Token token1;
      byte[] bs = new byte[5];
      memoryStream = new MemoryStream(bs, false);
      disposables.Add((IDisposable)memoryStream);
      byte[] bs1 = new byte[4];
      bs1[0] = (byte)127;
      bs1[1] = (byte)127;
      bs1[2] = (byte)127;
      bs1[3] = (byte)127;
      characterStream = new CharacterStream();
      characterStream.fp = (Stream)memoryStream;
      characterStream.stream_ind = 1;
      characterStream.stream = bs1;
      byte[] bs2 = new byte[5];
      token = new Token();
      token.token_string = bs2;
      token.token_id = 0;
      TokenStream s0 = new TokenStream();
      s0.ch_stream = characterStream;
      byte[] bs3 = new byte[5];
      token1 = this.error_or_eof_case(s0, token, 0, bs3, 4, (byte)0);
      disposables.Dispose();
      Assert.IsNotNull((object)token1);
      Assert.IsNotNull((object)(token1.token_string));
      Assert.AreEqual<int>(5, token1.token_string.Length);
      Assert.AreEqual<byte>((byte)0, token1.token_string[0]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[1]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[2]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[3]);
      Assert.AreEqual<byte>((byte)0, token1.token_string[4]);
      Assert.AreEqual<int>(0, token1.token_id);
    }
}