代码拉取完成,页面将自动刷新
package sort;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
public class SelectionSortDemoTest {
@Test
public void testSelectionSort(){
int[] arr = new int[]{64, 34, 25, 12, 22, 11, 90};
SelectionSortDemo.selectionSort(arr);
int[] result = new int[]{11, 12, 22, 25, 34, 64, 90};
Assertions.assertArrayEquals(result, arr);
}
@Test
@DisplayName("测试选择排序迭代版")
public void testSelectionSortIterative(){
int[] arr = new int[]{64, 34, 25, 12, 22, 11, 90};
SelectionSortDemo.selectionSortIterative(arr);
int[] result = new int[]{11, 12, 22, 25, 34, 64, 90};
Assertions.assertArrayEquals(result, arr);
}
@Test
@DisplayName("测试选择排序递归版")
public void testSelectionSortRecursive(){
int[] arr = new int[]{64, 34, 25, 12, 22, 11, 90};
SelectionSortDemo.selectionSortRecursive(arr);
int[] result = new int[]{11, 12, 22, 25, 34, 64, 90};
Assertions.assertArrayEquals(result, arr);
}
@Test
@DisplayName("测试选择排序递归版自顶向下")
public void testSelectionSortRecursive2(){
int[] arr = new int[]{64, 34, 25, 12, 22, 11, 90};
SelectionSortDemo.selectionSortRecursive2(arr);
int[] result = new int[]{11, 12, 22, 25, 34, 64, 90};
Assertions.assertArrayEquals(result, arr);
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。