Inheritance: AbstractTerm
示例#1
0
 public void IsStructure()
 {
     ListTerm t = new ListTerm();
     AbstractTerm a = new ListTerm();
     Assert.IsFalse(t.IsStructure);
     Assert.IsFalse(a.IsStructure);
 }
示例#2
0
 public void IsObject()
 {
     ListTerm t = new ListTerm();
     AbstractTerm a = new ListTerm();
     Assert.IsFalse(t.IsObject);
     Assert.IsFalse(a.IsObject);
 }
示例#3
0
 public void IsReference()
 {
     ListTerm t = new ListTerm();
     AbstractTerm a = new ListTerm();
     Assert.IsFalse(t.IsReference);
     Assert.IsFalse(a.IsReference);
 }
示例#4
0
 public void IsConstant()
 {
     ListTerm t = new ListTerm();
     AbstractTerm a = new ListTerm();
     Assert.IsFalse(t.IsConstant);
     Assert.IsFalse(a.IsConstant);
 }
示例#5
0
 public void IsList()
 {
     ListTerm t = new ListTerm();
     AbstractTerm a = new ListTerm();
     Assert.IsTrue(t.IsList);
     Assert.IsTrue(a.IsList);
 }
示例#6
0
        public void Bind()
        {
            ListTerm term = new ListTerm();
            ListTerm term2 = new ListTerm();

            term.Bind(term2);

            Assert.AreSame(term, term.Reference());
        }
示例#7
0
        public void Dereference()
        {
            ListTerm term1 = new ListTerm();
            ListTerm term2 = new ListTerm();
            ListTerm term3 = new ListTerm();

            term2.Bind(term3);
            term1.Bind(term2);

            Assert.AreSame(term1, term1.Dereference());
        }
示例#8
0
        public void Unify_str_lis()
        {
            StructureTerm s = new StructureTerm("s", 2);
            ListTerm l = new ListTerm();

            Assert.IsFalse(s.Unify(l));
        }
示例#9
0
        public void ListTerm()
        {
            ListTerm list = new ListTerm();

            Assert.IsNotNull(list);
        }
示例#10
0
        public void Unify_list_ref_lis()
        {
            ListTerm list1 = new ListTerm();
            list1.Next = new AbstractTerm();
            list1.Next.Next = new ConstantTerm("[]");

            ListTerm list2 = new ListTerm();
            list2.Next = new ConstantTerm("ali");
            list2.Next.Next = new ConstantTerm("[]");

            Assert.IsTrue(list1.Unify(list2));

            Assert.AreEqual(list1.Head.Data(), list2.Head.Data());
        }
示例#11
0
 public void Data()
 {
     ListTerm t = new ListTerm();
     Assert.IsNull(t.Data());
 }
示例#12
0
        public void Unify_lis_str()
        {
            ListTerm list = new ListTerm();
            StructureTerm con = new StructureTerm("s", 2);

            Assert.IsFalse(list.Unify(con));
        }
示例#13
0
        public void Unify_lis_ref()
        {
            ListTerm list = new ListTerm();
            list.Next = new ConstantTerm("ali");
            list.Next.Next = new ConstantTerm("samir");

            AbstractTerm term = new AbstractTerm();

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

            Assert.AreSame(list.Head, term.Head);
            Assert.AreSame(list.Tail, term.Tail);
        }
示例#14
0
        public void Unify_lis_ne_lis()
        {
            ListTerm list1 = new ListTerm();
            list1.Next = new ConstantTerm("ali");
            list1.Next.Next = new ConstantTerm("[]");

            ListTerm list2 = new ListTerm();
            list2.Next = new ConstantTerm("ali");
            list2.Next.Next = new ConstantTerm("foo");

            Assert.IsFalse(list1.Unify(list2));
        }
示例#15
0
        public void Unify_lis_con()
        {
            ListTerm list = new ListTerm();
            ConstantTerm con = new ConstantTerm();

            Assert.IsFalse(list.Unify(con));
        }
示例#16
0
        public void Unify_con_lis()
        {
            ConstantTerm con = new ConstantTerm("ali");
            ListTerm term = new ListTerm();

            Assert.IsFalse(con.Unify(term));
        }
示例#17
0
        public void Unify_ref_lis()
        {
            AbstractTerm term = new AbstractTerm();
            ListTerm con = new ListTerm();

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

            Assert.AreSame(term.Reference(), con.Reference());
            Assert.IsTrue(term.IsList);
            Assert.IsFalse(term.IsReference);
        }
示例#18
0
        public void Push_ListTerm()
        {
            AMHeap heap = new AMHeap();

            ListTerm con = new ListTerm();

            heap.Push(con);

            Assert.AreSame(con, heap.Top());
        }