Unify() public method

public Unify ( AbstractTerm term ) : bool
term AbstractTerm
return bool
示例#1
0
        public void Unify_str_con()
        {
            ConstantTerm term = new ConstantTerm("ali");
            StructureTerm s = new StructureTerm("s", 2);

            Assert.IsFalse(s.Unify(term));
        }
示例#2
0
        public void Unify_str_ref_str()
        {
            StructureTerm s1 = new StructureTerm("s", 1);
            s1.Next = new AbstractTerm();

            StructureTerm s2 = new StructureTerm("s", 1);
            s2.Next = new ConstantTerm("ali");

            Assert.IsTrue(s1.Unify(s2));

            Assert.AreEqual(s1[0].Data(), s2[0].Data());
        }
示例#3
0
        public void Unify_str_ne_str()
        {
            StructureTerm s1 = new StructureTerm("s", 2);
            s1.Next = new ConstantTerm("ali");
            s1.Next.Next = new ConstantTerm("samir");

            StructureTerm s2 = new StructureTerm("s", 2);
            s2.Next = new ConstantTerm("samir");
            s2.Next.Next = new ConstantTerm("samir");

            Assert.IsFalse(s1.Unify(s2));
        }
示例#4
0
        public void Unify_str_ref()
        {
            AbstractTerm term = new AbstractTerm();
            StructureTerm s = new StructureTerm("s", 2);

            Assert.IsTrue(s.Unify(term));

            Assert.AreEqual(term.Arity, s.Arity);
            Assert.AreEqual(term.Name, s.Name);
        }
示例#5
0
        public void Unify_str_lis()
        {
            StructureTerm s = new StructureTerm("s", 2);
            ListTerm l = new ListTerm();

            Assert.IsFalse(s.Unify(l));
        }