コード例 #1
0
        public void OperateTwoTest()
        {
            Variable p = new Variable('p');
            Variable q = new Variable('q');

            BiImplication a = new BiImplication();

            a.Operate(p, q);
            Assert.AreEqual(p, a.Childs[0]);
            Assert.AreEqual(q, a.Childs[1]);

            Assert.ThrowsException <ArgumentNullException>(() => a.Operate(null, null));
        }
コード例 #2
0
        public void ToStringTest()
        {
            Variable      p = new Variable('p');
            Variable      q = new Variable('q');
            BiImplication a = new BiImplication(p, q);

            Assert.AreEqual("(p = q)", a.ToString());

            Not Left  = new Not(p);
            Or  Right = new Or(p, q);

            a.Operate(Left, Right);

            Assert.AreEqual("(~p = (p | q))", a.ToString());

            Left = new Not(new Nand(p, q));
            a.Operate(Left, Right);

            Assert.AreEqual("(~(p % q) = (p | q))", a.ToString());
        }
コード例 #3
0
        public void OperateListTest()
        {
            List <Variable> vars = new List <Variable>()
            {
                new Variable('p'),
                new Variable('q')
            };

            BiImplication a = new BiImplication();

            a.Operate(vars);
            Assert.AreEqual(vars[0], a.Childs[0]);
            Assert.AreEqual(vars[1], a.Childs[1]);
        }