Beispiel #1
0
        public void IsShouldReturnArray()
        {
            var first  = ListNode.Create(new[] { 1, 2, 3 });
            var result = first.ToIntArray();

            result.Should().Equal(1, 2, 3);
        }
Beispiel #2
0
        public static void Test()
        {
            int[]    l1      = new int[] { 9 };
            int[]    l2      = new int[] { 9, 9, 9, 9 };
            ListNode retNode = AddTwoNumbers(ListNode.Create(l1), ListNode.Create(l2));

            while (null != retNode)
            {
                Console.WriteLine(retNode.val);
                retNode = retNode.next;
            }
            Console.ReadKey();
        }
Beispiel #3
0
        public void IsShouldCreateList()
        {
            var first = ListNode.Create(new[] { 1, 2, 3 });

            first.val.Should().Be(1);

            var second = first.next;

            second.Should().NotBeNull();
            second.val.Should().Be(2);

            var third = second.next;

            third.Should().NotBeNull();
            third.val.Should().Be(3);
        }