/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/java/com/thealgorithms/maths/AbsoluteMinTest.java
27 строк
821 B
Muhammad Rizwan
Fix AbsoluteMin bug for equal absolute values (#6145)
19 янв 2025, 19:50
Не верифицирован
19 янв 2025, 19:50
0e0539e
Код
Авторство
О чём код?
package com.thealgorithms.maths; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; public class AbsoluteMinTest { @Test void testGetMinValue() { assertEquals(0, AbsoluteMin.getMinValue(4, 0, 16)); assertEquals(-2, AbsoluteMin.getMinValue(3, -10, -2)); } @Test void testGetMinValueWithNoArguments() { Exception exception = assertThrows(IllegalArgumentException.class, AbsoluteMin::getMinValue); assertEquals("Numbers array cannot be empty", exception.getMessage()); } @Test void testGetMinValueWithSameAbsoluteValues() { assertEquals(-5, AbsoluteMin.getMinValue(-5, 5)); assertEquals(-5, AbsoluteMin.getMinValue(5, -5)); } }