mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-28 23:15:17 +08:00
style: enable ArrayTypeStyle
in checkstyle (#5145)
This commit is contained in:
@ -13,11 +13,11 @@ class NonRepeatingNumberFinderTest {
|
||||
|
||||
@Test
|
||||
void testNonRepeatingNumberFinder() {
|
||||
int arr[] = {1, 2, 1, 2, 6};
|
||||
int[] arr = {1, 2, 1, 2, 6};
|
||||
assertEquals(6, NonRepeatingNumberFinder.findNonRepeatingNumber(arr));
|
||||
int arr1[] = {1, 2, 1, 2};
|
||||
int[] arr1 = {1, 2, 1, 2};
|
||||
assertEquals(0, NonRepeatingNumberFinder.findNonRepeatingNumber(arr1));
|
||||
int arr2[] = {12};
|
||||
int[] arr2 = {12};
|
||||
assertEquals(12, NonRepeatingNumberFinder.findNonRepeatingNumber(arr2));
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import org.junit.jupiter.api.Test;
|
||||
public class ActivitySelectionTest {
|
||||
@Test
|
||||
public void testActivitySelection() {
|
||||
int start[] = {1, 3, 0, 5, 8, 5};
|
||||
int end[] = {2, 4, 6, 7, 9, 9};
|
||||
int[] start = {1, 3, 0, 5, 8, 5};
|
||||
int[] end = {2, 4, 6, 7, 9, 9};
|
||||
|
||||
ArrayList<Integer> result = ActivitySelection.activitySelection(start, end);
|
||||
ArrayList<Integer> expected = new ArrayList<>(Arrays.asList(0, 1, 3, 4));
|
||||
@ -20,8 +20,8 @@ public class ActivitySelectionTest {
|
||||
|
||||
@Test
|
||||
public void testSingleActivity() {
|
||||
int start[] = {1};
|
||||
int end[] = {2};
|
||||
int[] start = {1};
|
||||
int[] end = {2};
|
||||
|
||||
ArrayList<Integer> result = ActivitySelection.activitySelection(start, end);
|
||||
ArrayList<Integer> expected = new ArrayList<>(Arrays.asList(0));
|
||||
@ -31,8 +31,8 @@ public class ActivitySelectionTest {
|
||||
|
||||
@Test
|
||||
public void testNoOverlap() {
|
||||
int start[] = {1, 2, 3};
|
||||
int end[] = {2, 3, 4};
|
||||
int[] start = {1, 2, 3};
|
||||
int[] end = {2, 3, 4};
|
||||
|
||||
ArrayList<Integer> result = ActivitySelection.activitySelection(start, end);
|
||||
ArrayList<Integer> expected = new ArrayList<>(Arrays.asList(0, 1, 2));
|
||||
|
@ -8,24 +8,24 @@ public class FractionalKnapsackTest {
|
||||
|
||||
@Test
|
||||
public void testFractionalKnapsackWithExampleCase() {
|
||||
int weight[] = {10, 20, 30};
|
||||
int value[] = {60, 100, 120};
|
||||
int[] weight = {10, 20, 30};
|
||||
int[] value = {60, 100, 120};
|
||||
int capacity = 50;
|
||||
assertEquals(240, FractionalKnapsack.fractionalKnapsack(weight, value, capacity));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFractionalKnapsackWithZeroCapacity() {
|
||||
int weight[] = {10, 20, 30};
|
||||
int value[] = {60, 100, 120};
|
||||
int[] weight = {10, 20, 30};
|
||||
int[] value = {60, 100, 120};
|
||||
int capacity = 0;
|
||||
assertEquals(0, FractionalKnapsack.fractionalKnapsack(weight, value, capacity));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFractionalKnapsackWithEmptyItems() {
|
||||
int weight[] = {};
|
||||
int value[] = {};
|
||||
int[] weight = {};
|
||||
int[] value = {};
|
||||
int capacity = 50;
|
||||
assertEquals(0, FractionalKnapsack.fractionalKnapsack(weight, value, capacity));
|
||||
}
|
||||
|
Reference in New Issue
Block a user