style: enable ArrayTypeStyle in checkstyle (#5145)

This commit is contained in:
Piotr Idzik
2024-05-06 21:49:52 +02:00
committed by GitHub
parent 414835db11
commit bfb27eeb59
5 changed files with 22 additions and 22 deletions

View File

@ -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));
}
}

View File

@ -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));

View File

@ -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));
}