Ai
2 Star 0 Fork 0

CS-IMIS-23/20172311hai

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
SortingTest.java 2.01 KB
一键复制 编辑 原始数据 按行查看 历史
socialsea 提交于 2018-11-19 19:58 +08:00 . 实验三(1),选择排序方法的测试
package week7;
import org.junit.Test;
import static org.junit.Assert.*;
public class SortingTest {
Integer[]a1={1,2,3,4,5,6,7,8,2311};
Integer[]a2={2,3,5,67,76,77,89,2311};
Character[]a3={'1','2','3','4','a','b'};
Integer[]b1={2311,8,7,6,5,4,3,2,1};
Integer[]b2={2311,89,77,76,67,5,3,2};
Character[]b3={'b','a','4','3','2','1'};
Integer[]c1={2,34,21,32,1,45,2311,34};
Integer[]c2={30,3,25,34,12,4,2311,38};
Integer[]c3={5,324,2,21,11,42,2311,3};
Integer[]c4={2311,32,1,13,45,23,35,324};
//正序
@Test
public void selectionSort1() throws Exception {
assertEquals("[1, 2, 3, 4, 5, 6, 7, 8, 2311]",Sorting.selectionSort(a1));
}
@Test
public void selectionSort2() throws Exception {
assertEquals("[2, 3, 5, 67, 76, 77, 89, 2311]",Sorting.selectionSort(a2));
}
@Test
public void selectionSort3() throws Exception {
assertEquals("[1, 2, 3, 4, a, b]",Sorting.selectionSort(a3));
}
//逆序
@Test
public void selectionSort4() throws Exception {
assertEquals("[1, 2, 3, 4, 5, 6, 7, 8, 2311]",Sorting.selectionSort(b1));
}
@Test
public void selectionSort5() throws Exception {
assertEquals("[2, 3, 5, 67, 76, 77, 89, 2311]",Sorting.selectionSort(b2));
}
@Test
public void selectionSort6() throws Exception {
assertEquals("[1, 2, 3, 4, a, b]",Sorting.selectionSort(b3));
}
//正常
@Test
public void selectionSort7() throws Exception {
assertEquals("[1, 2, 21, 32, 34, 34, 45, 2311]",Sorting.selectionSort(c1));
}
@Test
public void selectionSort8() throws Exception {
assertEquals("[3, 4, 12, 25, 30, 34, 38, 2311]",Sorting.selectionSort(c2));
}
@Test
public void selectionSort9() throws Exception {
assertEquals("[2, 3, 5, 11, 21, 42, 324, 2311]",Sorting.selectionSort(c3));
}
@Test
public void selectionSort10() throws Exception {
assertEquals("[1, 13, 23, 32, 35, 45, 324, 2311]",Sorting.selectionSort(c4));
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/CS-IMIS-23/20172311hai.git
git@gitee.com:CS-IMIS-23/20172311hai.git
CS-IMIS-23
20172311hai
20172311hai
master

搜索帮助