/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/java/com/thealgorithms/greedyalgorithms/ActivitySelectionTest.java
44 строки
1 KB
Strange Developer
General performance improvement (#6078)
01 ноя 2024, 20:52
Не верифицирован
01 ноя 2024, 20:52
df0c997
Код
Авторство
О чём код?
package com.thealgorithms.greedyalgorithms; import static java.util.Collections.singletonList; import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.Arrays; import java.util.List; 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}; ArrayList<Integer> result = ActivitySelection.activitySelection(start, end); ArrayList<Integer> expected = new ArrayList<>(Arrays.asList(0, 1, 3, 4)); assertEquals(expected, result); } @Test public void testSingleActivity() { int[] start = {1}; int[] end = {2}; ArrayList<Integer> result = ActivitySelection.activitySelection(start, end); List<Integer> expected = singletonList(0); assertEquals(expected, result); } @Test public void testNoOverlap() { 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)); assertEquals(expected, result); } }