public void TestCA_DetSample()
        {
            var regex = new Regex(".*a.{4,8}a", RegexOptions.Singleline);
            var sr    = (SymbolicRegex <ulong>)regex.Compile(true, false);
            var aut   = sr.Pattern.CreateCountingAutomaton();
            var det   = CsAutomaton <ulong> .CreateFrom(aut);

            Assert.IsTrue(aut.NrOfCounters == 1);
            //aut.ShowGraph("", true);
            //det.ShowGraph("det", false, true);
        }
        public void TestCA_DotStarMonadicLoopInStar()
        {
            var regex = new Regex(".*(.{9})*", RegexOptions.Singleline);
            var sr    = (SymbolicRegex <ulong>)regex.Compile(true, false);
            var aut   = sr.Pattern.CreateCountingAutomaton();
            var det   = CsAutomaton <ulong> .CreateFrom(aut);

            Assert.IsTrue(aut.NrOfCounters == 1);
            //aut.ShowGraph("");
            //det.ShowGraph("DotStarMonadicLoopInStar_det");
        }
        public void TestCA_CsAutomatonConstruction3()
        {
            Microsoft.Automata.DirectedGraphs.Options.MaxDgmlTransitionLabelLength = 500;
            var regex = new Regex(".*ab{9}d", RegexOptions.Singleline);
            var sr    = (SymbolicRegex <ulong>)regex.Compile(true, false);
            var aut   = sr.Pattern.CreateCountingAutomaton();
            //aut.ShowGraph("CsAutomatonConstruction3_nondet");
            var det = CsAutomaton <ulong> .CreateFrom(aut);

            //det.ShowGraph("CsAutomatonConstruction3_det");
            Assert.IsTrue(det.StateCount == 3);
        }
        public void TestCA_CsAutomatonConstruction1()
        {
            var regex = new Regex(".*(a{5}|[aA]a{5})*", RegexOptions.Singleline);
            var sr    = (SymbolicRegex <ulong>)regex.Compile(true, false);
            var aut   = sr.Pattern.CreateCountingAutomaton();

            //aut.ShowGraph("CsAutomatonConstruction1");
            Assert.IsTrue(aut.IsMatch("xAaaaaa"));
            Assert.IsTrue(aut.IsMatch("xaaaaaa"));
            Assert.IsTrue(aut.IsMatch("xaaaaabaa"));
            var det = CsAutomaton <ulong> .CreateFrom(aut);
        }
        public void TestCA_LoopTwice()
        {
            var regex = new Regex("[ab]{5,9}[bc]{7,19}", RegexOptions.Singleline);
            var q1    = ((SymbolicRegex <ulong>)regex.Compile(true, false)).Pattern;
            var aut   = q1.CreateCountingAutomaton();
            var daut  = CsAutomaton <ulong> .CreateFrom(aut);

            //Assert.IsTrue(aut.NrOfCounters == 2);
            //Assert.IsTrue(aut.MoveCount == 4);
            //Assert.IsTrue(aut.NrOfCounters == 2);
            //aut.ShowGraph("LoopTwice",true);
            //daut.ShowGraph("LoopTwice_det", true);
        }
        public void TestCA_a3()
        {
            var regex = new Regex("(a{3})*", RegexOptions.Singleline);
            var q1    = ((SymbolicRegex <ulong>)regex.Compile(true, false)).Pattern;
            var aut   = q1.CreateCountingAutomaton();

            Assert.IsTrue(aut.StateCount == 2);
            Assert.IsTrue(aut.NrOfCounters == 1);
            //aut.ShowGraph("aaa");
            var daut = CsAutomaton <ulong> .CreateFrom(aut);

            //daut.ShowGraph("aaa_det", true);
        }
        public void TestCA_TrickyCase2()
        {
            var regex = new Regex("d{1,20}aUa$|d{1,20}aOa$", RegexOptions.Singleline);
            var sr    = (SymbolicRegex <ulong>)regex.Compile(false, false);
            var q1    = sr.Pattern;
            var aut   = q1.CreateCountingAutomaton();

            Assert.IsTrue(aut.NrOfCounters == 2);
            var CsA = CsAutomaton <ulong> .CreateFrom(aut);

            //aut.ShowGraph("TrickyCase2_NCA", true);
            //CsA.ShowGraph("TrickyCase2_DCA_dbg", true, false);
            //CsA.ShowGraph("TrickyCase2_DCA", false, true);
        }
        public void TestCA_Discussion()
        {
            var regex = new Regex("b*[ab][ab]{9}", RegexOptions.Singleline);
            var sr    = (SymbolicRegex <ulong>)regex.Compile(true, false);
            var q1    = sr.Pattern;
            var aut   = q1.CreateCountingAutomaton();

            Assert.IsTrue(aut.NrOfCounters == 1);
            var CsA = CsAutomaton <ulong> .CreateFrom(aut);

            //aut.ShowGraph("Discussion_NCA", true);
            //CsA.ShowGraph("Discussion_DCA_dbg", true, false);
            //CsA.ShowGraph("Discussion_DCA", false, true);
        }
Esempio n. 9
0
        public void TestCA_TrickyCase()
        {
            var regex = new Regex("([ab]{3,6}[bc]{4,8})*", RegexOptions.Singleline);
            var sr    = (SymbolicRegex <ulong>)regex.Compile(true, false);
            var q1    = sr.Pattern;
            var aut   = q1.CreateCountingAutomaton();

            Assert.IsTrue(aut.NrOfCounters == 2);
            var CsA = CsAutomaton <ulong> .CreateFrom(aut);

            aut.ShowGraph("TrickyCase_NCA", true);
            CsA.ShowGraph("TrickyCase_DCA_dbg", true, false);
            CsA.ShowGraph("TrickyCase_DCA", false, true);
        }
Esempio n. 10
0
        public void TestCA_ATVARunningExample()
        {
            var regex = new Regex(".*a.{300}", RegexOptions.Singleline);
            var sr    = (SymbolicRegex <ulong>)regex.Compile(true, false);
            var q1    = sr.Pattern;

            Assert.IsTrue(q1.kind == SymbolicRegexKind.Concat);
            Assert.IsTrue(q1.ConcatCount == 2);
            var aut = q1.CreateCountingAutomaton();

            Assert.IsTrue(aut.NrOfCounters == 1);
            //aut.ShowGraph("ATVARunningExample");
            var CsA = CsAutomaton <ulong> .CreateFrom(aut);

            //CsA.ShowGraph("ATVARunningExample_det", false);
        }