Exemplo n.º 1
0
        public void generateGraph_takesInputAndOutputPaths_generatesPictureAtOutputPath()
        {
            Node   testNode1   = new Node("TS1");
            Node   testNode2   = new Node("TS2");
            var    states      = new List <Node>(new Node[] { testNode1, testNode2 });
            var    final       = new List <Node>(new Node[] { testNode1 });
            var    alphabet    = new List <string>(new string[] { "t", "e", "s" });
            string stack       = null;
            var    transitions = new List <Transition>();

            transitions.Add(new Transition("t", testNode2, testNode1));
            transitions.Add(new Transition("e", testNode2, testNode1));
            transitions.Add(new Transition("s", testNode2, testNode2));
            transitions.Add(new Transition("t", testNode1, testNode2));
            transitions.Add(new Transition("e", testNode1, testNode2));
            transitions.Add(new Transition("s", testNode1, testNode2));
            var words = new List <string>();

            words.AddRange(new string[] { "test", "set", "sit" });
            Automaton testInput = new Automaton(alphabet, states, final, transitions, true, false, words);

            GVgenerator.generateGraph("D:/projects/ALE2/ALE2_libraryTests/materials/graphvizInput.txt", "D:/projects/ALE2/ALE2_libraryTests/materials/testPicture");

            Assert.IsTrue(File.Exists("../../materials/testPicture.png"));
        }
Exemplo n.º 2
0
        private void showGraph(Automaton inputAutomaton)
        {
            string path = "./graph";

            GVgenerator.generateGraph(inputAutomaton, path);
            pbGraph.ImageLocation = path + ".png";
        }
Exemplo n.º 3
0
        public void readRegex_passRegularExpression_returnParsedAutomaton(string input, string path)
        {
            //string input = ".(z, | (h, *(.(q, z))))";
            string graphInput  = "../../materials/regexpParsedInput" + (indexer) + ".txt";
            string graphOutput = "../../materials/regexpParsedOutput" + (indexer++) + ".txt";
            //Automaton expectedResult = Parser.parseFile(path);

            Automaton testResult = RegexReader.readRegex(input);

            GVgenerator.generateGraphVizInput(testResult, graphInput);
            GVgenerator.generateGraph(graphInput, graphOutput);
            //Assert.AreEqual(expectedResult, testResult);
        }