Ai
1 Star 0 Fork 0

郝黎阳/JHU-CS226-Fall25

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
SelectionSortDemoTest.java 1.44 KB
一键复制 编辑 原始数据 按行查看 历史
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);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hao-liyang/JHU-CS226-Fall25.git
git@gitee.com:hao-liyang/JHU-CS226-Fall25.git
hao-liyang
JHU-CS226-Fall25
JHU-CS226-Fall25
main

搜索帮助