Example #1
0
 @Test
 public void threeElementArrayWithDuplicatedValueLowerThanPivot() {
   assertThat(IntegerSort.sort(new int[] {4, 5, 4}), is(equalTo(new int[] {4, 4, 5})));
 }
Example #2
0
 @Test
 public void sixElementArray() {
   assertThat(
       IntegerSort.sort(new int[] {4, 5, 4, 5, 5, 4}), is(equalTo(new int[] {4, 4, 4, 5, 5, 5})));
 }
Example #3
0
 @Test
 public void fiveElementArrayFirstTwoNeedsSorting() {
   assertThat(IntegerSort.sort(new int[] {4, 3, 5, 6, 7}), is(equalTo(new int[] {3, 4, 5, 6, 7})));
 }
Example #4
0
 @Test
 public void emptyArrayReturnsEmptyArray() {
   assertThat(IntegerSort.sort(new int[0]), is(equalTo(new int[0])));
 }
Example #5
0
 @Test
 public void sevenElementArrayReturnsSorted() {
   assertThat(
       IntegerSort.sort(new int[] {9, 8, 7, 6, 5, 4, 3}),
       is(equalTo(new int[] {3, 4, 5, 6, 7, 8, 9})));
 }
Example #6
0
 @Test
 public void threeElementArrayMovesLeftPointer() {
   assertThat(IntegerSort.sort(new int[] {4, 6, 5}), is(equalTo(new int[] {4, 5, 6})));
 }
Example #7
0
 @Test
 public void fiveElementArrayReturnsSorted() {
   assertThat(IntegerSort.sort(new int[] {3, 6, 5, 4, 7}), is(equalTo(new int[] {3, 4, 5, 6, 7})));
 }
Example #8
0
 @Test
 public void threeElementArrayReturnsSorted() {
   assertThat(IntegerSort.sort(new int[] {6, 5, 4}), is(equalTo(new int[] {4, 5, 6})));
 }
Example #9
0
 @Test
 public void twoElementSortedArrayReturnsItself() {
   assertThat(IntegerSort.sort(new int[] {5, 6}), is(equalTo(new int[] {5, 6})));
 }
Example #10
0
 @Test
 public void twoElementArrayIsReturnedSorted() {
   assertThat(IntegerSort.sort(new int[] {6, 5}), is(equalTo(new int[] {5, 6})));
 }
Example #11
0
 @Test
 public void singleElementArrayReturnsItself() {
   assertThat(IntegerSort.sort(new int[] {5}), is(equalTo(new int[] {5})));
 }