mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-28 06:55:02 +08:00
Add Partition Problem (#4182)
This commit is contained in:
@ -0,0 +1,24 @@
|
||||
package com.thealgorithms.dynamicprogramming;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class PartitionProblemTest {
|
||||
@Test
|
||||
public void testIfSumOfTheArrayIsOdd(){
|
||||
assertFalse(PartitionProblem.partition(new int[]{1, 2, 2}));
|
||||
}
|
||||
@Test
|
||||
public void testIfSizeOfTheArrayIsOne(){
|
||||
assertFalse(PartitionProblem.partition(new int[]{2}));
|
||||
}
|
||||
@Test
|
||||
public void testIfSumOfTheArrayIsEven1(){
|
||||
assertTrue(PartitionProblem.partition(new int[]{1, 2, 3, 6}));
|
||||
}
|
||||
@Test
|
||||
public void testIfSumOfTheArrayIsEven2(){
|
||||
assertFalse(PartitionProblem.partition(new int[]{1, 2, 3, 8}));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user