Beispiel #1
0
        public void Simple()
        {
            var node = new LlNode <char>('a');

            node.Chain('b').Chain('c').Chain('d');

            Assert.That(Backward(node), Is.EqualTo("dcba"));
        }
Beispiel #2
0
        public void Lists_Not_Equal2()
        {
            var n1 = new LlNode <int>(1);

            n1.Chain(8);

            var n2  = new LlNode <int>(0);
            var sum = Sum(n2, n1);

            Assert.That(sum.Data, Is.EqualTo(1));
            Assert.That(sum.Next.Data, Is.EqualTo(8));
            Assert.That(sum.Next.Next, Is.Null);
        }
Beispiel #3
0
        public void Simple()
        {
            var node1 = new LlNode <int>(2);

            node1.Chain(4).Chain(3);
            var node2 = new LlNode <int>(5);

            node2.Chain(6).Chain(4);
            var sum = Sum(node1, node2);

            Assert.That(sum.Data, Is.EqualTo(7));
            Assert.That(sum.Next.Data, Is.EqualTo(0));
            Assert.That(sum.Next.Next.Data, Is.EqualTo(8));
            Assert.That(sum.Next.Next.Next, Is.Null);
        }