Exemplo n.º 1
0
 public void TestShiftLeftThenRight()
 {
     BDDAlgebra solver = new BDDAlgebra();
     BDD cond = solver.MkSetFromElements(new uint[] { 0, 15 }, 3);
     //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(cond, "TestShiftLeft2_cond", "c:/tmp/TestShiftLeft2_cond.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
     BDD bvs = solver.ShiftLeft(cond, 4);
     BDD concat = solver.MkAnd(bvs, cond);
     Assert.AreEqual<int>(16, concat.CountNodes());
     BDD cond1 = solver.ShiftRight(solver.ShiftRight(solver.ShiftRight(solver.ShiftRight(concat))));
     Assert.AreEqual<BDD>(cond1, cond);
     //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(concat, "TestShiftLeft2_concat", "c:/tmp/TestShiftLeft2_concat.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
 }
Exemplo n.º 2
0
        public void TestShiftLeftThenRight()
        {
            BDDAlgebra solver = new BDDAlgebra();
            BDD        cond   = solver.MkSetFromElements(new uint[] { 0, 15 }, 3);
            //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(cond, "TestShiftLeft2_cond", "c:/tmp/TestShiftLeft2_cond.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
            BDD bvs    = solver.ShiftLeft(cond, 4);
            BDD concat = solver.MkAnd(bvs, cond);

            Assert.AreEqual <int>(16, concat.CountNodes());
            BDD cond1 = solver.ShiftRight(solver.ShiftRight(solver.ShiftRight(solver.ShiftRight(concat))));

            Assert.AreEqual <BDD>(cond1, cond);
            //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(concat, "TestShiftLeft2_concat", "c:/tmp/TestShiftLeft2_concat.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
        }
Exemplo n.º 3
0
 public void TestShiftRight2()
 {
     BDDAlgebra solver = new BDDAlgebra();
     BDD cond = solver.MkSetFromElements(new uint[] {0, 15}, 3);
     Assert.AreEqual<int>(9, cond.CountNodes());
     //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(cond, "TestShiftRight", "c:/tmp/TestShiftRight2.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
     var sr = solver.ShiftRight(cond);
     Assert.AreEqual<int>(7, sr.CountNodes());
     //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(sr, "TestShiftRight", "c:/tmp/TestShiftRight2res.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
 }
Exemplo n.º 4
0
 public void TestShiftRight1()
 {
     BDDAlgebra solver = new BDDAlgebra();
     BDD cond1 = solver.MkSetFromRange(0, 7, 3);
     BDD cond2 = solver.MkSetFromElements(new uint[] {9, 10, 12, 15}, 3);
     BDD cond = solver.MkOr(cond1, cond2);
     Assert.AreEqual<int>(8, cond.CountNodes());
     //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(cond, "TestShiftRight", "c:/tmp/TestShiftRight1.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
     BDD sr = solver.ShiftRight(cond);
     Assert.AreEqual<BDD>(solver.True, sr);
 }
Exemplo n.º 5
0
        public void TestShiftRight2()
        {
            BDDAlgebra solver = new BDDAlgebra();
            BDD        cond   = solver.MkSetFromElements(new uint[] { 0, 15 }, 3);

            Assert.AreEqual <int>(9, cond.CountNodes());
            //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(cond, "TestShiftRight", "c:/tmp/TestShiftRight2.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
            var sr = solver.ShiftRight(cond);

            Assert.AreEqual <int>(7, sr.CountNodes());
            //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(sr, "TestShiftRight", "c:/tmp/TestShiftRight2res.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
        }
Exemplo n.º 6
0
        public void TestShiftRight1()
        {
            BDDAlgebra solver = new BDDAlgebra();
            BDD        cond1  = solver.MkSetFromRange(0, 7, 3);
            BDD        cond2  = solver.MkSetFromElements(new uint[] { 9, 10, 12, 15 }, 3);
            BDD        cond   = solver.MkOr(cond1, cond2);

            Assert.AreEqual <int>(8, cond.CountNodes());
            //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(cond, "TestShiftRight", "c:/tmp/TestShiftRight1.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
            BDD sr = solver.ShiftRight(cond);

            Assert.AreEqual <BDD>(solver.True, sr);
        }