public void TestShellSort_1() { int[] array = new int[] { 12, 8, 17, 13, 10, 16, 15, 2, 5, 1, 4, 6, 14, 7, 11, 9, 3 }; SortLevel.ShellSort(array); for (int i = 0; i < array.Length; i++) { Assert.AreEqual(i + 1, array[i]); } }
public void TestShellSort_5() { int[] array = new int[] { 5, 4, 3, 2, 1 }; int[] expay = new int[] { 0, 33, 11, 7, 9 }; SortLevel.ShellSort(array); for (int i = 0; i < array.Length; i++) { Assert.IsTrue(expay[i] != array[i]); } }
public void TestShellSort_4() { int[] array = new int[] { 5, 4, 3, 2, 1 }; int[] expay = new int[] { 1, 2, 3, 4, 5 }; SortLevel.ShellSort(array); for (int i = 0; i < array.Length; i++) { Assert.AreEqual(expay[i], array[i]); } }
public void TestShellSort_2() { int[] array = new int[] { 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 35, 34, 33, 32, 31, 17, 16, 15, 14, 13, 12, 11, 10, 30, 29, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; int[] expay = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 }; SortLevel.ShellSort(array); for (int i = 0; i < array.Length; i++) { Assert.AreEqual(expay[i], array[i]); } }
public static void TestShellSort() { var array = new int[] { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; SortLevel.ShellSort(array); var ethalon = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; Assert.AreEqual(ethalon.Length, array.Length); for (int i = 0; i < array.Length; i++) { Assert.AreEqual(ethalon[i], array[i]); } }