ソートアルゴリズム計画その1.4
バブルソートテストの部分
@Test public void 引数に与えた配列の要素数が複数のバブルソート() throws Exception { BubbleSort bubble = new BubbleSort(); List<Integer> sourceData = new ArrayList<Integer>(); sourceData.add(5); sourceData.add(3); sourceData.add(10); sourceData.add(1); List<Integer> exceptedList = new ArrayList<Integer>(); exceptedList.add(1); exceptedList.add(3); exceptedList.add(5); exceptedList.add(10); List<Integer> resultList = bubble.sort(sourceData); assertThat(exceptedList.size(), is(resultList.size())); for (int i = 0; i <= exceptedList.size()-1; i++) { System.out.println(resultList.get(i)); assertThat(exceptedList.get(i), is(resultList.get(i))); } }