public void MaxElementTest() { int[] data = { 1, 2, 3, 5, 6, 2, 1, 8, 1, 4, 6 }; int expected = 8; using (LibNavigate.Iterator.IInputIterator <int> inputIterator = new LibNavigate.Iterator.Extend.InputIterator <int>(data)) { int actual = Algorithm.MaxElement(inputIterator); Assert.IsTrue(expected == actual); } }
public void MinElementTest() { int[] data = { 3, 4, 5, 8, 1, 8, 23, 54, 12, 65 }; int expected = 1; using (LibNavigate.Iterator.IInputIterator <int> inputIterator = new LibNavigate.Iterator.Extend.InputIterator <int>(data)) { int actual = Algorithm.MinElement(inputIterator); Assert.IsTrue(expected == actual); } }
public void LexicographicalCompareTest() { char[] data = { 'a', 'b', 'c', 'd' }; using (LibNavigate.Iterator.IInputIterator <char> inputIterator1 = new LibNavigate.Iterator.Extend.InputIterator <char>(data)) { using (LibNavigate.Iterator.IInputIterator <char> inputIterator2 = new LibNavigate.Iterator.Extend.InputIterator <char>(data)) { bool result = Algorithm.LexicographicalCompare(inputIterator1, inputIterator2); Assert.IsFalse(result); } } }
public void MinMaxElementTest() { int[] data = { 3, 4, 5, 8, 1, 8, 23, 54, 12, 65, 1, 2, 3, 5, 6, 2, 0, 8, 1, 4, 6 }; KeyValuePair <int, int> expected = new KeyValuePair <int, int>(0, 65); using (LibNavigate.Iterator.IInputIterator <int> inputIterator = new LibNavigate.Iterator.Extend.InputIterator <int>(data)) { KeyValuePair <int, int> actual = Algorithm.MinMaxElement(inputIterator); Assert.IsTrue(expected.Key == actual.Key && expected.Value == actual.Value); } }