- Notifications
You must be signed in to change notification settings - Fork 19.9k
/
Copy pathGenericRootTest.java
26 lines (21 loc) · 970 Bytes
/
GenericRootTest.java
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
packagecom.thealgorithms.maths;
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
importjava.util.stream.Stream;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.Arguments;
importorg.junit.jupiter.params.provider.MethodSource;
publicclassGenericRootTest {
@ParameterizedTest
@MethodSource("tcStream")
publicvoidtestGenericRoot(finalintinput, finalintexpected) {
assertEquals(expected, GenericRoot.genericRoot(input));
}
@ParameterizedTest
@MethodSource("tcStream")
publicvoidtestGenericRootWithNegativeInputs(finalintinput, finalintexpected) {
assertEquals(expected, GenericRoot.genericRoot(-input));
}
privatestaticStream<Arguments> tcStream() {
returnStream.of(Arguments.of(0, 0), Arguments.of(1, 1), Arguments.of(12345, 6), Arguments.of(123, 6), Arguments.of(15937, 7), Arguments.of(222222, 3), Arguments.of(99999, 9));
}
}