public void TestNextLesserPanlindrome() { IComparer x = new StructInt32d(); int[] input = new int[] { 9, 9, 9, 9, 9, 9 }; var expected = Tuple.Create(998899, new int[] { 9, 9, 8, 8, 9, 9 }); var actual = FunctionLib.NextLesserPanlindrome(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); input = new int[] { 9, 9, 9, 9, 9 }; expected = Tuple.Create(99899, new int[] { 9, 9, 8, 9, 9 }); actual = FunctionLib.NextLesserPanlindrome(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); input = new int[] { 9, 9, 0, 9, 9 }; expected = Tuple.Create(98989, new int[] { 9, 8, 9, 8, 9 }); actual = FunctionLib.NextLesserPanlindrome(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); input = new int[] { 9 }; expected = Tuple.Create(8, new int[] { 8 }); actual = FunctionLib.NextLesserPanlindrome(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); }
public void TestNextEvenFibonacci() { IComparer x = new StructInt32d(); int[] input = new int[] { 1, 2 }; var expected = Tuple.Create(8, new int[] { 5, 8 }); var actual = FunctionLib.NextEvenFibonacci(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); actual = FunctionLib.NextEvenFibonacci(input); input = new int[] { 2, 3 }; actual = FunctionLib.NextEvenFibonacci(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); input = new int[] { 3, 5 }; actual = FunctionLib.NextEvenFibonacci(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); }
public void TestNextLesserPanlindrome() { IComparer x = new StructInt32d(); int[] input = new int[] { 9,9,9,9,9,9}; var expected = Tuple.Create(998899, new int[] { 9,9,8,8,9,9 }); var actual = FunctionLib.NextLesserPanlindrome(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); input = new int[] { 9,9,9,9,9 }; expected = Tuple.Create(99899, new int[] { 9, 9, 8, 9, 9 }); actual = FunctionLib.NextLesserPanlindrome(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); input = new int[] { 9,9,0,9,9 }; expected = Tuple.Create(98989, new int[] { 9, 8,9,8, 9 }); actual = FunctionLib.NextLesserPanlindrome(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); input = new int[] { 9}; expected = Tuple.Create(8, new int[] { 8 }); actual = FunctionLib.NextLesserPanlindrome(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); }
public void TestNextEvenFibonacci() { IComparer x = new StructInt32d(); int[] input = new int[] { 1, 2 }; var expected = Tuple.Create(8, new int[] { 5, 8 }); var actual = FunctionLib.NextEvenFibonacci(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2)==0); actual = FunctionLib.NextEvenFibonacci(input); input = new int[] { 2, 3 }; actual = FunctionLib.NextEvenFibonacci(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); input = new int[] {3,5 }; actual = FunctionLib.NextEvenFibonacci(input); Assert.AreEqual(expected.Item1, actual.Item1); Assert.IsTrue(x.Compare(expected.Item2, actual.Item2) == 0); }