Exemple #1
0
        public void TestPairs()
        {
            NumValue valueTwo = new NumValue(2);
            Value    pair     = new PairValue <NumValue, NumValue>(valueTwo, valueTwo);

            Assert.AreEqual("< 2 , 2 >", pair.ToString());

            Expression test = new PairExpression <NumExpression, NumExpression>(two, two);

            Assert.AreEqual("< 2 , 2 >", testAsync(test, 500).Result);

            var trueTest = new PairExpression <LogicExpression, LogicExpression>(logicTrue, logicTrue);

            Assert.AreEqual("< True , True >", testAsync(trueTest, 500).Result);

            var loopTest = new PairExpression <LogicExpression, LogicExpression>(logicLoop, logicTrue);

            Assert.AreEqual(False, testAsync(loopTest, 500).Result);

            var pairTest = new LogicProjL(trueTest);

            Assert.AreEqual(True, testAsync(pairTest, 500).Result);

            var pairLoop = new LogicProjR(loopTest);

            Assert.AreEqual(True, testAsync(pairLoop, 500).Result);

            var pairLoop2 = new LogicProjL(loopTest);

            Assert.AreEqual(Loop, testAsync(pairLoop2, 500).Result);
        }
Exemple #2
0
        public void TestString()
        {
            var step2   = x & m <= new NumConstant(5);
            var rec2    = new RecLogicExpression(n, logicTrue, "m", "x", step2);
            var testLog = new NumConstant(6) == new NumThe("n", n > new NumConstant(5) & rec2);

            Assert.AreEqual("(6 == The n. ((n > 5) & Rec(n, True, m.x. (x & (m <= 5)))))", testLog.ToString());

            var test5 = new Apply(new LambdaExpression("x", x | logicTrue), logicLoop);

            Assert.AreEqual("(Lambda x. (x | True) @ Exists n. (n < n))", test5.ToString());

            var loopTest = new PairExpression <LogicExpression, LogicExpression>(logicLoop, logicTrue);
            var pairLoop = new LogicProjR(loopTest);

            Assert.AreEqual("Snd <Exists n. (n < n), True>", pairLoop.ToString());
        }