Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a273455

Browse files
update asm3
1 parent 957d03b commit a273455

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package test;
2+
3+
import com.rampatra.sorting.BubbleSort;
4+
import org.junit.jupiter.api.Test;
5+
6+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
7+
8+
public class BubbleSortTest {
9+
@Test
10+
public void testWithEmptyArray(){
11+
int[] inputArray = {};
12+
int[] expectOutput = {};
13+
BubbleSort.bubbleSort(inputArray);
14+
assertArrayEquals(expectOutput, inputArray);
15+
}
16+
17+
@Test
18+
public void testWithOneValue(){
19+
int[] inputArray = {100};
20+
int[] expectOutput = {100};
21+
BubbleSort.bubbleSort(inputArray);
22+
assertArrayEquals(expectOutput, inputArray);
23+
}
24+
25+
@Test
26+
public void testWithAnCompletedArray(){
27+
int[] inputArray = {3,2,5,1,4,7,9,0};
28+
int[] expectOutput = {0,1,2,3,4,5,7,9};
29+
BubbleSort.bubbleSort(inputArray);
30+
assertArrayEquals(expectOutput, inputArray);
31+
}
32+
33+
@Test
34+
public void testWithSortedArray(){
35+
int[] inputArray = {0,1,2,3,4,5,7,9};
36+
int[] expectOutput = {0,1,2,3,4,5,7,9};
37+
BubbleSort.bubbleSort(inputArray);
38+
assertArrayEquals(expectOutput, inputArray);
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package test;
2+
3+
import com.rampatra.sorting.SelectionSort;
4+
import org.junit.jupiter.api.Test;
5+
6+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
7+
8+
public class SelectionSortTest {
9+
@Test
10+
public void testWithEmptyArray(){
11+
int[] inputArray = {};
12+
int[] expectOutput = {};
13+
SelectionSort.selectionSort(inputArray);
14+
assertArrayEquals(expectOutput, inputArray);
15+
}
16+
17+
@Test
18+
public void testWithOneValue(){
19+
int[] inputArray = {100};
20+
int[] expectOutput = {100};
21+
SelectionSort.selectionSort(inputArray);
22+
assertArrayEquals(expectOutput, inputArray);
23+
}
24+
25+
@Test
26+
public void testWithAnCompletedArray(){
27+
int[] inputArray = {3,2,5,1,4,7,9,0};
28+
int[] expectOutput = {0,1,2,3,4,5,7,9};
29+
SelectionSort.selectionSort(inputArray);
30+
assertArrayEquals(expectOutput, inputArray);
31+
}
32+
33+
@Test
34+
public void testWithSortedArray(){
35+
int[] inputArray = {0,1,2,3,4,5,7,9};
36+
int[] expectOutput = {0,1,2,3,4,5,7,9};
37+
SelectionSort.selectionSort(inputArray);
38+
assertArrayEquals(expectOutput, inputArray);
39+
}
40+
}

0 commit comments

Comments
 (0)