Example #1
0
        public void TestGetLongestConsecutiveSubsequence_TheWholeSequenceIsTheLongestOne()
        {
            int[]      arr      = new int[] { 1, 1, 1, 1, 1 };
            List <int> sequence = new List <int>(arr);

            List <int> subsequence = LongestSubsequenceMain.GetLongestConsecutiveSubsequence(sequence);

            Assert.AreEqual("1 1 1 1 1", LongestSubsequenceMain.GetAsString(subsequence).Trim());
        }
Example #2
0
        public void TestGetLongestConsecutiveSubsequence_OnlyOneLongestSubsequence()
        {
            int[]      arr      = new int[] { 1, 2, 2, 3, 3, 4, 4, 4, 5, 5 };
            List <int> sequence = new List <int>(arr);

            List <int> subsequence = LongestSubsequenceMain.GetLongestConsecutiveSubsequence(sequence);

            Assert.AreEqual("4 4 4", LongestSubsequenceMain.GetAsString(subsequence).Trim());
        }
Example #3
0
        public void TestGetLongestConsecutiveSubsequence_TwoLongestSubsequences()
        {
            int[]      arr      = new int[] { 1, 1, 1, 2, 2, 3, 3, 3 };
            List <int> sequence = new List <int>(arr);

            List <int> subsequence = LongestSubsequenceMain.GetLongestConsecutiveSubsequence(sequence);

            Assert.AreEqual("1 1 1", LongestSubsequenceMain.GetAsString(subsequence).Trim());
        }
Example #4
0
        public void TestGetLongestConsecutiveSubsequence_OnlyOneElement()
        {
            List <int> sequence = new List <int>();

            sequence.Add(1);

            List <int> subsequence = LongestSubsequenceMain.GetLongestConsecutiveSubsequence(sequence);

            Assert.AreEqual("1", LongestSubsequenceMain.GetAsString(subsequence).Trim());
        }
Example #5
0
        public void TestGetLongestConsecutiveSubsequence_EmptyList()
        {
            List <int> sequence = new List <int>();

            LongestSubsequenceMain.GetLongestConsecutiveSubsequence(sequence);
        }
Example #6
0
        public void TestGetLongestConsecutiveSubsequence_NullList()
        {
            List <int> sequence = null;

            LongestSubsequenceMain.GetLongestConsecutiveSubsequence(sequence);
        }