Skip to content

Commit

Permalink
test aws
Browse files Browse the repository at this point in the history
  • Loading branch information
brendonmiranda committed Oct 12, 2024
1 parent 9eaae1b commit 556b759
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/aws/OptimizingBoxWeights.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class OptimizingBoxWeights {
The union of A and B is equal to the original array.
The number of elements in subset A is minimal.
The sum of A's weights is greater than the sum of B's weights.*/
public static int[] packItems(int[] arr) {
public int[] packItems(int[] arr) {

Arrays.sort(arr);

Expand Down
25 changes: 25 additions & 0 deletions src/test/java/aws/OptimizingBoxWeightsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package aws;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class OptimizingBoxWeightsTest {

@Test
public void test() {

OptimizingBoxWeights optimizingBoxWeights = new OptimizingBoxWeights();
var subA = optimizingBoxWeights.packItems(new int[]{5, 3, 2, 4, 1, 2});
Assertions.assertEquals(subA[0], 4);
Assertions.assertEquals(subA[1], 5);

subA = optimizingBoxWeights.packItems(new int[]{4, 2, 5, 1, 6});
Assertions.assertEquals(subA[0], 5);
Assertions.assertEquals(subA[1], 6);

subA = optimizingBoxWeights.packItems(new int[]{3, 7, 5, 6, 2});
Assertions.assertEquals(subA[0], 6);
Assertions.assertEquals(subA[1], 7);
}

}

0 comments on commit 556b759

Please sign in to comment.