Beispiel #1
0
        public void TestSum()
        {
            var sum = new SumLinkedList(); //6357 + 28564 = 34921
            var a   = new LinkedList <int>();

            a.AddLast(7);
            a.AddLast(5);
            a.AddLast(3);
            a.AddLast(6);
            var b = new LinkedList <int>();

            b.AddLast(4);
            b.AddLast(6);
            b.AddLast(5);
            b.AddLast(8);
            b.AddLast(2);
            var result = new LinkedList <int>();

            result.AddLast(1);
            result.AddLast(2);
            result.AddLast(9);
            result.AddLast(4);
            result.AddLast(3);
            var expected = result;
            var actual   = sum.Sum(a, b);

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public void TestSimplerSum()
        {
            var sum = new SumLinkedList(); //5+63 = 68
            var a   = new LinkedList <int>();

            a.AddLast(5);
            var b = new LinkedList <int>();

            b.AddLast(3);
            b.AddLast(6);
            var result = new LinkedList <int>();

            result.AddLast(8);
            result.AddLast(6);
            var expected = result;
            var actual   = sum.Sum(a, b);

            Assert.AreEqual(expected, actual);
        }