Beispiel #1
0
        public void TestComputeNodeWhenDivByZero()
        {
            var a = new NodeValue(4);
            var b = new NodeValue(0);
            var c = new NodeOperator(Operator.DIV, a, b);

            c.Compute();
        }
Beispiel #2
0
        public void TestComputeNodeWhenDiv()
        {
            var a = new NodeValue(4);
            var b = new NodeValue(2);
            var c = new NodeOperator(Operator.DIV, a, b);

            Assert.AreEqual(2, c.Compute());
        }
Beispiel #3
0
        public void TestComputeNodeWhenMult()
        {
            var a = new NodeValue(1);
            var b = new NodeValue(1);
            var c = new NodeOperator(Operator.MUL, a, b);

            Assert.AreEqual(1, c.Compute());
        }
Beispiel #4
0
        public void TestComputeNodeWhenASub()
        {
            var a = new NodeValue(1);
            var b = new NodeValue(1);
            var c = new NodeOperator(Operator.SUB, a, b);

            Assert.AreEqual(0, c.Compute());
        }
Beispiel #5
0
        public void TestComputeNodeWhenAdd()
        {
            var a = new NodeValue(1);
            var b = new NodeValue(1);
            var c = new NodeOperator(Operator.ADD, a, b);

            Assert.AreEqual(2, c.Compute());
        }
Beispiel #6
0
        public void TestComputeNodeWhitThreeValue()
        {
            var a = new NodeValue(1);
            var b = new NodeValue(1);
            var c = new NodeValue(1);
            var d = new NodeOperator(Operator.ADD, a, b);
            var e = new NodeOperator(Operator.ADD, d, c);

            Assert.AreEqual(3, e.Compute());
        }
Beispiel #7
0
        public void TestComputeNodeWithCalculPriority()
        {
            var a = new NodeValue(1);
            var b = new NodeValue(2);
            var c = new NodeValue(3);
            var d = new NodeValue(4);
            var e = new NodeOperator(Operator.MUL, b, c);
            var f = new NodeOperator(Operator.SUB, a, d);
            var g = new NodeOperator(Operator.ADD, e, f);

            Assert.AreEqual(3, g.Compute());
        }
Beispiel #8
0
        public void TestGetValueNodeNumber()
        {
            var a = new NodeValue(1);

            Assert.AreEqual(1, a.Compute());
        }