public void ConstConstNeTest()
        {
            IRExpression expression = 3;
            IRExpression template   = 7;
            var          mapping    = new Dictionary <IRVariable, IRExpression>();

            Assert.IsFalse(expression.Unify(template, mapping));
        }
        public void ConstConstEqTest()
        {
            IRExpression expression = 3;
            IRExpression template   = 3;
            var          mapping    = new Dictionary <IRVariable, IRExpression>();

            Assert.IsTrue(expression.Unify(template, mapping));
            Assert.AreEqual(0, mapping.Count);
        }
        public void VarConstTest()
        {
            IRExpression expression   = 3;
            var          templateVarA = new IRRegisterVariable(IRPrimitive.S32, "a");
            var          template     = templateVarA;
            var          mapping      = new Dictionary <IRVariable, IRExpression>();

            Assert.IsTrue(expression.Unify(template, mapping));
            Assert.AreEqual(1, mapping.Count);
            Assert.AreEqual(mapping[templateVarA], expression);
        }
        public void MultiVarNeTest2()
        {
            IRExpression irConst3     = 3;
            IRExpression irConst2     = 2;
            IRExpression expression   = irConst3 + irConst2;
            var          templateVarA = new IRRegisterVariable(IRPrimitive.S32, "a");
            var          template     = templateVarA + templateVarA;
            var          mapping      = new Dictionary <IRVariable, IRExpression>();

            Assert.IsFalse(expression.Unify(template, mapping));
        }
        public void MultiVarEqTest2()
        {
            IRExpression irConst3     = 3;
            IRExpression expression   = irConst3 + irConst3;
            var          templateVarA = new IRRegisterVariable(IRPrimitive.S32, "a");
            var          template     = templateVarA + templateVarA;
            var          mapping      = new Dictionary <IRVariable, IRExpression>();

            Assert.IsTrue(expression.Unify(template, mapping));
            Assert.AreEqual(1, mapping.Count);
            Assert.AreEqual(mapping[templateVarA], irConst3);
        }