Exemple #1
0
        public void ArrayDeref_Test5()
        {
            ArrayDereference target = new ArrayDereference();

            List <Token> tokenList = Tokenizer.Tokenize("return a");
            List <Token> expected  = Tokenizer.Tokenize("return a");

            List <Token> actual;

            actual = target.Run(tokenList);

            Assert.IsTrue(expected.SequenceEqual <Token>(actual),
                          "Expected: \"" + string.Join <Token>(" ", expected.ToArray()) + "\" " +
                          "Actual: \"" + string.Join <Token>(" ", actual.ToArray()) + "\"");
        }
Exemple #2
0
        public void ArrayDeref_Test3()
        {
            ArrayDereference target = new ArrayDereference();

            List <Token> tokenList = Tokenizer.Tokenize("int a[10]; a[a[5]] = 3;");
            List <Token> expected  = Tokenizer.Tokenize("int a[10]; *(a + (*(a + 5))) = 3;");

            List <Token> actual;

            actual = target.Run(tokenList);

            Assert.IsTrue(expected.SequenceEqual <Token>(actual),
                          "Expected: \"" + string.Join <Token>(" ", expected.ToArray()) + "\" " +
                          "Actual: \"" + string.Join <Token>(" ", actual.ToArray()) + "\"");
        }