Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 21.3k
Expand file tree
/
Copy pathPollardRhoTest.java
More file actions
Latest commit
49 lines (37 loc) · 1.19 KB
/
Copy pathPollardRhoTest.java
File metadata and controls
49 lines (37 loc) · 1.19 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
packagecom.thealgorithms.maths;
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
importstaticorg.junit.jupiter.api.Assertions.assertThrows;
importorg.junit.jupiter.api.Test;
classPollardRhoTest {
@Test
voidtestPollardRhoForNumber315MustReturn5() {
// given
intnumber = 315;
intexpectedResult = 5;
// when
intactualResult = PollardRho.pollardRho(number);
// then
assertEquals(expectedResult, actualResult);
}
@Test
voidtestPollardRhoForNumber187MustReturn11() {
// given
intnumber = 187;
intexpectedResult = 11;
// when
intactualResult = PollardRho.pollardRho(number);
// then
assertEquals(expectedResult, actualResult);
}
@Test
voidtestPollardRhoForNumber239MustThrowException() {
// given
intnumber = 239;
StringexpectedMessage = "GCD cannot be found.";
// when
Exceptionexception = assertThrows(RuntimeException.class, () -> { PollardRho.pollardRho(number); });
StringactualMessage = exception.getMessage();
// then
assertEquals(expectedMessage, actualMessage);
}
}