public void SortByMaximumOfTheElementsTest() { int[][] numbers = new int[3][]; numbers[0] = new int[] { 4, 2, 5, 6, 120 }; numbers[1] = new int[] { 5, 3, 1, 7, 12, 4, 2, 5 }; numbers[2] = new int[] { 12, 1, 4, 23, 5, 8 }; int[][] sorted = new int[3][]; sorted[0] = new int[] { 4, 2, 5, 6, 120 }; sorted[1] = new int[] { 5, 3, 1, 7, 12, 4, 2, 5 }; sorted[2] = new int[] { 12, 1, 4, 23, 5, 8 }; int[][] result = new int[3][]; result[0] = new int[] { 4, 2, 5, 6, 120 }; result[1] = new int[] { 12, 1, 4, 23, 5, 8 }; result[2] = new int[] { 5, 3, 1, 7, 12, 4, 2, 5 }; CreatingTypes.SortByMaximumOfTheElements(sorted); for (int i = 0; i < sorted.Length; i++) { for (int j = 0; j < sorted[i].Length; j++) { Assert.AreEqual(sorted[i][j], result[i][j]); } } }
public void Test_BubbleSortMin() { var matrix = new int[3][]; matrix[0] = new int[] { 12, 34, 1, 43, 56 }; matrix[1] = new int[] { 96, 54, 23, 30, 49 }; matrix[2] = new int[] { 24, 21, 90, 87, 41 }; CreatingTypes.BubbleSortMin(ref matrix, true); Assert.AreEqual(new[] { new int[] { 12, 34, 1, 43, 56 }, new int[] { 24, 21, 90, 87, 41 }, new int[] { 96, 54, 23, 30, 49 } }, matrix); }
public void BubbleSortByMin_ReturnsSortedMatrix() { int[,] setup = new int[, ] { { 3, 5, 6 }, { 7, 34, 2 }, { 9, 0, 21 } }; int[,] expected = new int[, ] { { 3, 5, 6 }, { 7, 34, 2 }, { 9, 0, 21 } }; // Actual CreatingTypes.BubbleSortByMin(setup); Assert.AreEqual(expected, setup); }
public double Test_FindNthRoot(double number, int degree, double precision) { var result = CreatingTypes.FindNthRoot(number, degree, precision); return(result); }
public void FindNthRoot_Number_Degree_Precision_ArgumentOutOfRangeException(double number, int degree, double precision) { var ex = Assert.Throws <System.ArgumentException>(() => { CreatingTypes.FindNthRoot(number, degree, precision); }); Assert.AreEqual("Value does not fall within the expected range.", ex.Message); }
public double FindNthRoot_Test(double number, int degree, double precision) { return(CreatingTypes.FindNthRoot(number, degree, precision)); }
public void FindNthRootTest2() { Assert.AreEqual(CreatingTypes.FindNthRoot(-0.008, 3, 0.1), -0.2); }
public void FindNthRootTest1() { Assert.AreEqual(CreatingTypes.FindNthRoot(1, 5, 0.0001), 1); }