public void OptimiseTokensResolveToOneExponent()
        {
            TokensOptimiser to = new TokensOptimiser();

            var input = new List <Token>()
            {
                _varX, _zero, _exponent, _varX, _varX, _multiply, _plus
            };
            var expectedOutput = new List <Token>()
            {
                _one, _varX, _two, _exponent, _plus
            };

            var actualOutput = to.OptimiseTokens(CopyTokens(input));
            var e            = $"Expected Output:\n{TokensToString(expectedOutput)}\nActual Output:\n{TokensToString(actualOutput)}";

            for (int i = 0; i < expectedOutput.Count; i++)
            {
                Assert.True(expectedOutput[i].Value == actualOutput[i].Value, e);
                Assert.True(expectedOutput[i].Type == actualOutput[i].Type, e);
            }
        }
        public void OptimiseTokensToIncreaseExponent()
        {
            TokensOptimiser to = new TokensOptimiser();

            //var input = new List<Token>() { _one, CopyToken(_one), _multiply, CopyToken(_one), CopyToken(_multiply), CopyToken(_one), CopyToken(_multiply) };
            var input = new List <Token>()
            {
                _one, _one, _multiply, _one, _multiply, _one, _multiply
            };
            var expectedOutput = new List <Token>()
            {
                _one, _four, _exponent
            };

            var actualOutput = to.OptimiseTokens(CopyTokens(input));
            var e            = $"Expected Output:\n{TokensToString(expectedOutput)}\nActual Output:\n{TokensToString(actualOutput)}";

            for (int i = 0; i < expectedOutput.Count; i++)
            {
                Assert.True(expectedOutput[i].Value == actualOutput[i].Value, e);
                Assert.True(expectedOutput[i].Type == actualOutput[i].Type, e);
            }
        }
        public void WhenIOptimiseTheReversePolishNotationTokens()
        {
            var to = new TokensOptimiser();

            _calculatorReversePolishTokens.ReversePolishTokens = to.OptimiseTokens(_calculatorReversePolishTokens.ReversePolishTokens);
        }