コード例 #1
0
        public void KIsBiggerThanInputSize()
        {
            LinkedListHelper <int> helper = new LinkedListHelper <int>();
            LinkedList <int>       input  = helper.CreateLinkedList(1, 2);

            GetKthToLast getKth = new GetKthToLast();

            Assert.Throws <ArgumentException>(() => getKth.GetKth_WithSizeInput(input, 4));
            Assert.Throws <ArgumentException>(() => getKth.GetKth_WithOutSizeInput(input, 4));
        }
コード例 #2
0
        public void BasicTest()
        {
            LinkedListHelper <int> helper = new LinkedListHelper <int>();
            LinkedList <int>       input  = helper.CreateLinkedList(1, 2, 3, 4, 5);

            GetKthToLast getKth = new GetKthToLast();
            int          k      = getKth.GetKth_WithSizeInput(input, 2);

            int r = getKth.GetKth_WithOutSizeInput(input, 2);

            Assert.Equal(4, k);
            Assert.Equal(4, r);
        }