示例#1
0
        static void TestingAutomaat <T>(string automaat_name, Automaat <T> a, List <Tuple <string, bool> > testWords) where T : IComparable
        {
            Console.WriteLine($"Testing automaat class, {automaat_name}");
            Console.WriteLine("Automaat is a DFA: " + a.IsDfa());

            foreach (Tuple <string, bool> word in testWords)
            {
                var geaccepteerd = a.Accepteer(word.Item1);
                Console.WriteLine($"Word: is {word.Item1} accepted?, expected: {word.Item2}, result: {geaccepteerd}");
                if (word.Item2 != geaccepteerd)
                {
                    Console.WriteLine("Niet verwachte resultaat");
                }
                Console.WriteLine("----------");
            }
            Console.WriteLine();
        }