|
1 | 1 | package com.thealgorithms.randomized;
|
2 |
| -import static org.junit.jupiter.api.Assertions.assertTrue; |
3 | 2 | import static org.junit.jupiter.api.Assertions.assertFalse;
|
| 3 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
4 | 4 |
|
5 | 5 | import java.math.BigInteger;
|
6 | 6 | import org.junit.jupiter.api.Test;
|
7 | 7 |
|
8 | 8 | /*
|
9 |
| -* Tests for MillerRabinPrimality |
10 |
| -* @author DomTr (https://github.com/DomTr) |
11 |
| -*/ |
| 9 | + * Tests for MillerRabinPrimality |
| 10 | + * @author DomTr (https://github.com/DomTr) |
| 11 | + */ |
12 | 12 |
|
13 | 13 | public class MillerRabinPrimalityTest {
|
14 | 14 | static final int iter = 10;
|
15 | 15 |
|
16 | 16 | @Test
|
17 | 17 | public void testComposites() {
|
18 |
| - long[] values = {1, 25, 2932021007403L, 4501680375506332L, 6910906992394051L, |
19 |
| - 4887521073398877L, 5577943644815725L, 6085993686552764L}; |
| 18 | + long[] values = {1, 25, 2932021007403L, 4501680375506332L, 6910906992394051L, 4887521073398877L, 5577943644815725L, 6085993686552764L}; |
20 | 19 |
|
21 | 20 | for (long v : values) {
|
22 | 21 | BigInteger val = BigInteger.valueOf(v);
|
@@ -58,7 +57,6 @@ public void testBigComposites() {
|
58 | 57 | BigInteger p3 = new BigInteger("924286031819653");
|
59 | 58 | BigInteger p4 = new BigInteger("408464000499539");
|
60 | 59 |
|
61 |
| - |
62 | 60 | assertFalse(MillerRabinPrimality.millerRabin(p1.multiply(p1), iter));
|
63 | 61 | assertFalse(MillerRabinPrimality.millerRabin(p1.multiply(p2), iter));
|
64 | 62 | assertFalse(MillerRabinPrimality.millerRabin(p1.multiply(p3), iter));
|
|
0 commit comments