mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
Format code with prettier (#3375)
This commit is contained in:
@@ -1,30 +1,38 @@
|
||||
package com.thealgorithms.backtracking;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CombinationTest {
|
||||
|
||||
@Test
|
||||
void testNoElement()
|
||||
{
|
||||
List<TreeSet<Integer>> result = Combination.combination(new Integer[]{1, 2}, 0);
|
||||
void testNoElement() {
|
||||
List<TreeSet<Integer>> result = Combination.combination(
|
||||
new Integer[] { 1, 2 },
|
||||
0
|
||||
);
|
||||
assertTrue(result == null);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLengthOne()
|
||||
{
|
||||
List<TreeSet<Integer>> result = Combination.combination(new Integer[]{1, 2}, 1);
|
||||
void testLengthOne() {
|
||||
List<TreeSet<Integer>> result = Combination.combination(
|
||||
new Integer[] { 1, 2 },
|
||||
1
|
||||
);
|
||||
assertTrue(result.get(0).iterator().next() == 1);
|
||||
assertTrue(result.get(1).iterator().next() == 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLengthTwo()
|
||||
{
|
||||
List<TreeSet<Integer>> result = Combination.combination(new Integer[]{1, 2}, 2);
|
||||
void testLengthTwo() {
|
||||
List<TreeSet<Integer>> result = Combination.combination(
|
||||
new Integer[] { 1, 2 },
|
||||
2
|
||||
);
|
||||
Integer[] arr = result.get(0).toArray(new Integer[2]);
|
||||
assertTrue(arr[0] == 1);
|
||||
assertTrue(arr[1] == 2);
|
||||
|
||||
Reference in New Issue
Block a user