コード例 #1
0
 public void TestShiftLeft1()
 {
     BDDAlgebra solver = new BDDAlgebra();
     BDD cond = solver.MkSetFromElements(new uint[] { 0, 15 }, 3);
     //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(cond, "TestShiftLeft", "c:/tmp/TestShiftLeftIn.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
     //BvSet bvs = solver.ShiftLeft(cond, 30);
     //Assert.AreEqual<int>(5, bvs.CountNodes());
     BDD bvs2 = solver.ShiftLeft(cond, 28);
     Assert.AreEqual<int>(9, bvs2.CountNodes());
     //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(bvs, "TestShiftLeft", "c:/tmp/TestShiftLeftOut.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
 }
コード例 #2
0
 public void TestUlongBvsSetCreation()
 {
     BDDAlgebra solver = new BDDAlgebra();
     BDD cond = solver.MkSetFromElements(new ulong[] { 0UL, (ulong)0xFFFFFFFF }, 31);
     BDD bvs = solver.ShiftLeft(cond, 4);
     var ranges = solver.ToRanges64(bvs, bvs.Ordinal);
     Assert.AreEqual<int>(2, ranges.Length);
     Assert.AreEqual<ulong>(0UL, ranges[0].First);
     Assert.AreEqual<ulong>(0xFUL, ranges[0].Second);
     Assert.AreEqual<ulong>((ulong)0xFFFFFFFF0, ranges[1].First);
     Assert.AreEqual<ulong>((ulong)0xFFFFFFFFF, ranges[1].Second);
 }
コード例 #3
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);
 }
コード例 #4
0
ファイル: CharSetTests.cs プロジェクト: wellsoftware/Automata
        public void TestShiftLeft1()
        {
            BDDAlgebra solver = new BDDAlgebra();
            BDD        cond   = solver.MkSetFromElements(new uint[] { 0, 15 }, 3);
            //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(cond, "TestShiftLeft", "c:/tmp/TestShiftLeftIn.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
            //BvSet bvs = solver.ShiftLeft(cond, 30);
            //Assert.AreEqual<int>(5, bvs.CountNodes());
            BDD bvs2 = solver.ShiftLeft(cond, 28);

            Assert.AreEqual <int>(9, bvs2.CountNodes());
            //Automata.Internal.DirectedGraphs.DotWriter.CharSetToDot(bvs, "TestShiftLeft", "c:/tmp/TestShiftLeftOut.dot", Internal.DirectedGraphs.DotWriter.RANKDIR.TB, 12);
        }
コード例 #5
0
ファイル: CharSetTests.cs プロジェクト: wellsoftware/Automata
        public void TestUlongBvsSetCreation()
        {
            BDDAlgebra solver = new BDDAlgebra();
            BDD        cond   = solver.MkSetFromElements(new ulong[] { 0UL, (ulong)0xFFFFFFFF }, 31);
            BDD        bvs    = solver.ShiftLeft(cond, 4);
            var        ranges = solver.ToRanges64(bvs, bvs.Ordinal);

            Assert.AreEqual <int>(2, ranges.Length);
            Assert.AreEqual <ulong>(0UL, ranges[0].First);
            Assert.AreEqual <ulong>(0xFUL, ranges[0].Second);
            Assert.AreEqual <ulong>((ulong)0xFFFFFFFF0, ranges[1].First);
            Assert.AreEqual <ulong>((ulong)0xFFFFFFFFF, ranges[1].Second);
        }
コード例 #6
0
ファイル: CharSetTests.cs プロジェクト: wellsoftware/Automata
        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);
        }