Ejemplo n.º 1
0
        public void Test_CsConditionSeq_Not()
        {
            CsConditionSeq seq = CsConditionSeq.MkFalse(64);

            Assert.IsFalse(seq.IsSatisfiable);
            Assert.IsTrue((~seq).IsValid);
            var seq1 = seq.Or(23, CsCondition.LOW).Or(23, CsCondition.MIDDLE);

            Assert.IsTrue(seq1.IsSatisfiable);
            Assert.IsTrue((~seq1).IsSatisfiable);
            var seq2 = seq1.Or(54, CsCondition.TRUE);

            Assert.IsTrue(seq2.IsValid);
            Assert.IsTrue(seq2.IsSatisfiable);
            Assert.IsFalse((~seq2).IsSatisfiable);
            Assert.AreEqual(seq1, ~~seq1);
            var rnd    = CsConditionSeq.MkTrue(10);
            var random = new Random(0);

            for (int i = 0; i < 10; i++)
            {
                rnd = rnd.And(i, (CsCondition)random.Next(1, 15));
            }
            Assert.IsTrue(rnd.IsSatisfiable);
            Assert.IsFalse(rnd.IsValid);
            Assert.IsTrue((~rnd).IsSatisfiable);
            Assert.IsFalse((~rnd).IsValid);
        }
Ejemplo n.º 2
0
        public void Test_CsConditionSeq_Or()
        {
            CsConditionSeq seq  = CsConditionSeq.MkFalse(64);
            var            seq1 = seq.Or(23, CsCondition.LOW).Or(23, CsCondition.MIDDLE);

            seq1 = seq1.Or(63, CsCondition.HIGH).Or(63, CsCondition.MIDDLE);
            Assert.IsTrue(seq1.IsSatisfiable);
            for (int i = 0; i < 64; i++)
            {
                if (i == 23)
                {
                    Assert.IsTrue(seq1[i] == CsCondition.CANLOOP);
                }
                else if (i == 63)
                {
                    Assert.IsTrue(seq1[i] == CsCondition.CANEXIT);
                }
                else
                {
                    Assert.IsTrue(seq1[i] == CsCondition.FALSE);
                }
            }
        }