Ejemplo n.º 1
0
        // Tests a sequence of characters
        private static void AssertIsOperator(string characters, bool result)
        {
            foreach (char c in characters)
            {
                bool isOperator = Brainf_ckParser.IsOperator(c);

                Assert.AreEqual(isOperator, result);
            }
        }
Ejemplo n.º 2
0
        public static bool HaveSameColor(char first, char second)
        {
            if (first == second)
            {
                return(true);
            }

            // Always have the lowest character in first position
            if (second > first)
            {
                (first, second) = (second, first);
            }

            return
                (!Brainf_ckParser.IsOperator(first) && !Brainf_ckParser.IsOperator(second) ||
                 first == Characters.BackwardPtr && second == Characters.ForwardPtr ||
                 first == Characters.Plus && second == Characters.Minus ||
                 first == Characters.LoopStart && second == Characters.LoopEnd ||
                 first == Characters.FunctionStart && second == Characters.FunctionEnd);
        }