fix: placement and tests

This commit is contained in:
2026-04-17 01:09:22 +03:30
parent 636de18d6c
commit 87affb5e56
8 changed files with 20 additions and 36 deletions
+65
View File
@@ -0,0 +1,65 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
public class MainTestPartitions {
static MainExercises ex;
@BeforeAll
static void setUp() {
ex = new MainExercises();
}
@Test
void testPartition0() {
int[][] expected = {
{1}
};
assertArrayEquals(expected, ex.intPartitions(1));
}
@Test
void testPartition1() {
int[][] expected = {
{4},
{3, 1},
{2, 2},
{2, 1, 1},
{1, 1, 1, 1}
};
assertArrayEquals(expected, ex.intPartitions(4));
}
@Test
void testPartition2() {
int[][] expected = {
{5},
{4, 1},
{3, 2},
{3, 1, 1},
{2, 2, 1},
{2, 1, 1, 1},
{1, 1, 1, 1, 1}
};
assertArrayEquals(expected, ex.intPartitions(5));
}
@Test
void testPartition3() {
int[][] expected = {
{6},
{5, 1},
{4, 2},
{4, 1, 1},
{3, 3},
{3, 2, 1},
{3, 1, 1, 1},
{2, 2, 2},
{2, 2, 1, 1},
{2, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1}
};
assertArrayEquals(expected, ex.intPartitions(6));
}
}