예제 #1
0
        public void nestedNots(int depth)
        {
            var  pair     = GetVarAndIdExpr("foo", BasicType.Bool);
            var  variable = pair.Item1;
            var  id       = pair.Item2;
            var  cfb      = GetConstantFoldingBuilder();
            Expr result   = id;

            for (int i = 0; i < depth; ++i)
            {
                result = cfb.Not(result);
                CheckIsBoolType(result);
            }

            if (depth % 2 == 0)
            {
                Assert.AreSame(id, result);
            }
            else
            {
                var asNot = ExprUtil.AsNot(result);
                Assert.IsNotNull(asNot);
                Assert.AreSame(id, asNot.Args[0]);
            }
        }
예제 #2
0
        public void IsNotWithAnd()
        {
            var sb    = GetSimpleBuilder();
            var v     = GetVarAndIdExpr("foo", BasicType.Bool).Item2;
            var e     = sb.And(v, v);
            var asNot = ExprUtil.AsNot(e);

            Assert.IsNull(asNot);
        }
예제 #3
0
        public void noFold()
        {
            var cfb    = GetConstantFoldingBuilder();
            var id     = GetVarAndIdExpr("foo", BasicType.Bool).Item2;
            var result = cfb.Not(id);

            CheckIsBoolType(result);
            var asNot = ExprUtil.AsNot(result);

            Assert.IsNotNull(asNot);
            Assert.AreSame(id, asNot.Args[0]);
        }