forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEgyptianFractionTest.java
More file actions
22 lines (17 loc) · 923 Bytes
/
EgyptianFractionTest.java
File metadata and controls
22 lines (17 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.thealgorithms.greedyalgorithms;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
public class EgyptianFractionTest {
@ParameterizedTest
@MethodSource("fractionProvider")
public void testGetEgyptianFraction(int numerator, int denominator, List<String> expected) {
assertEquals(expected, EgyptianFraction.getEgyptianFraction(numerator, denominator));
}
private static Stream<Arguments> fractionProvider() {
return Stream.of(Arguments.of(2, 3, List.of("1/2", "1/6")), Arguments.of(3, 10, List.of("1/4", "1/20")), Arguments.of(1, 3, List.of("1/3")), Arguments.of(1, 2, List.of("1/2")), Arguments.of(4, 13, List.of("1/4", "1/18", "1/468")));
}
}