forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbsoluteMinTest.java
More file actions
31 lines (25 loc) · 1.03 KB
/
Copy pathAbsoluteMinTest.java
File metadata and controls
31 lines (25 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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(2, AbsoluteMin.getMinValue(-5, 2));
assertEquals(0, AbsoluteMin.getMinValue(4, 0, 16));
assertEquals(-2, AbsoluteMin.getMinValue(3, -10, -2));
assertEquals(-2, AbsoluteMin.getMinValue(-5, -2));
assertEquals(2, AbsoluteMin.getMinValue(5, 2));
}
@Test
void testGetMinValueWithNoArguments() {
Exception exception = assertThrows(IllegalArgumentException.class, AbsoluteMin::getMinValue);
assertEquals("Numbers array cannot be empty", exception.getMessage());
}
@Test
void testGetMinValueWithSameAbsoluteValues() {
assertEquals(-3, AbsoluteMin.getMinValue(-3, 3));
assertEquals(-5, AbsoluteMin.getMinValue(-5, 5));
assertEquals(-5, AbsoluteMin.getMinValue(5, -5));
}
}