Example #1
0
        public void List_Add_list_doc()
        {
            var t = new PlTerm("[x,y]");
            var l = new PlTerm("[a,b]");

            Assert.IsTrue(l.IsList);
            Assert.IsTrue(l.AddList(t));
            Assert.IsTrue(l.IsList);
            Assert.AreEqual("[a,b,x,y]", l.ToString());
            Assert.AreEqual("a", l.NextValue().ToString());
            Assert.AreEqual("b", l.NextValue().ToString());
            Assert.AreEqual("[x,y]", l.ToString());
        }
Example #2
0
        public void List_Add_list()
        {
            var t = new PlTerm("[x,y]");
            var l = new PlTerm("[a,b]");

            Assert.AreEqual("[x,y]", t.ToString(), "t != [x,y]");
            Assert.AreEqual("[a,b]", l.ToString(), "l != [a,b]");

            Assert.IsTrue(l.AddList(t), "Add returns false");
            Assert.AreEqual("[a,b,x,y]", l.ToString(), "l != [a,b,x,y]");

            Assert.AreEqual(4, list_length(l), "list_length l");
            // NOTE list T is a PlTail so
            Assert.AreEqual("[a,b,x,y]", l.ToString(), "string comp");
        }