Skip to content

Commit 505a2f2

Browse files
author
alxklm
committed
checkstyle: fix formatting, revert test
1 parent 6690617 commit 505a2f2

File tree

2 files changed

+68
-7
lines changed

2 files changed

+68
-7
lines changed

src/main/java/com/thealgorithms/sorts/RadixSort.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.thealgorithms.sorts;
22

33
import com.thealgorithms.maths.NumberOfDigits;
4-
54
import java.util.Arrays;
65

76
/**
Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,79 @@
11
package com.thealgorithms.sorts;
22

3+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
4+
5+
import org.junit.jupiter.api.Test;
6+
37
/**
48
* @author Rebecca Velez (https://github.com/rebeccavelez)
59
* @see SlowSort
610
*/
711

8-
public class SlowSortTest extends SortingAlgorithmTest {
9-
protected int getGeneratedArraySize() {
10-
return 100;
12+
public class SlowSortTest {
13+
14+
private SlowSort slowSort = new SlowSort();
15+
16+
@Test
17+
public void slowSortEmptyArray() {
18+
Integer[] inputArray = {};
19+
Integer[] outputArray = slowSort.sort(inputArray);
20+
Integer[] expectedOutput = {};
21+
assertArrayEquals(outputArray, expectedOutput);
22+
}
23+
24+
@Test
25+
public void slowSortSingleIntegerElementArray() {
26+
Integer[] inputArray = {5};
27+
Integer[] outputArray = slowSort.sort(inputArray);
28+
Integer[] expectedOutput = {5};
29+
assertArrayEquals(outputArray, expectedOutput);
30+
}
31+
32+
@Test
33+
public void slowSortSingleStringElementArray() {
34+
String[] inputArray = {"k"};
35+
String[] outputArray = slowSort.sort(inputArray);
36+
String[] expectedOutput = {"k"};
37+
assertArrayEquals(outputArray, expectedOutput);
38+
}
39+
40+
@Test
41+
public void slowSortIntegerArray() {
42+
Integer[] inputArray = {8, 84, 53, -683, 953, 64, 2, 202, 98, -10};
43+
Integer[] outputArray = slowSort.sort(inputArray);
44+
Integer[] expectedOutput = {-683, -10, 2, 8, 53, 64, 84, 98, 202, 953};
45+
assertArrayEquals(outputArray, expectedOutput);
46+
}
47+
48+
@Test
49+
public void slowSortDuplicateIntegerArray() {
50+
Integer[] inputArray = {8, 84, 8, -2, 953, 64, 2, 953, 98};
51+
Integer[] outputArray = slowSort.sort(inputArray);
52+
Integer[] expectedOutput = {-2, 2, 8, 8, 64, 84, 98, 953, 953};
53+
assertArrayEquals(outputArray, expectedOutput);
54+
}
55+
56+
@Test
57+
public void slowSortStringArray() {
58+
String[] inputArray = {"g", "d", "a", "b", "f", "c", "e"};
59+
String[] outputArray = slowSort.sort(inputArray);
60+
String[] expectedOutput = {"a", "b", "c", "d", "e", "f", "g"};
61+
assertArrayEquals(outputArray, expectedOutput);
62+
}
63+
64+
@Test
65+
public void slowSortDuplicateStringArray() {
66+
String[] inputArray = {"g", "d", "a", "g", "b", "f", "d", "c", "e"};
67+
String[] outputArray = slowSort.sort(inputArray);
68+
String[] expectedOutput = {"a", "b", "c", "d", "d", "e", "f", "g", "g"};
69+
assertArrayEquals(outputArray, expectedOutput);
1170
}
1271

13-
@Override
14-
SortAlgorithm getSortAlgorithm() {
15-
return new SlowSort();
72+
@Test
73+
public void slowSortStringSymbolArray() {
74+
String[] inputArray = {"cbf", "auk", "ó", "(b", "a", ")", "au", "á", "cba", "auk", "(a", "bhy", "cba"};
75+
String[] outputArray = slowSort.sort(inputArray);
76+
String[] expectedOutput = {"(a", "(b", ")", "a", "au", "auk", "auk", "bhy", "cba", "cba", "cbf", "á", "ó"};
77+
assertArrayEquals(outputArray, expectedOutput);
1678
}
1779
}

0 commit comments

Comments
 (0)