Skip to content

Commit fbffeb6

Browse files
committed
refactor: update FastPower
1 parent 64bd1a1 commit fbffeb6

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed
File renamed without changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package src.test.java.com.others;
2+
3+
/**
4+
* @author bingo
5+
* @since 2019/5/10
6+
*/
7+
8+
public class FastPowerTest {
9+
}

src/main/java/com/Others/FastPowerTest.java renamed to src/test/java/com/others/FastPowerTest.java___jb_tmp___

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
1-
package src.main.java.com.Others;
1+
package src.test.java.com.others;
22

3-
import org.junit.*;
3+
import org.junit.Test;
4+
import src.main.java.com.others.FastPower;
45

56
import java.math.BigInteger;
67

78
import static org.junit.Assert.*;
89

910
public class FastPowerTest {
1011

11-
void testLong(long n, long k, long m){
12-
long result = FastPower.calculate(n,k,m);
12+
@Test
13+
void testLong(long n, long k, long m) {
14+
long result = FastPower.calculate(n, k, m);
1315
assertEquals(result, BigInteger.valueOf(n).modPow(BigInteger.valueOf(k), BigInteger.valueOf(m)).longValue());
1416
}
1517

16-
void testBigInteger(BigInteger n, BigInteger k, BigInteger m){
17-
BigInteger result = FastPower.calculate(n,k,m);
18-
assertEquals(result, n.modPow(k,m));
18+
@Test
19+
void testBigInteger(BigInteger n, BigInteger k, BigInteger m) {
20+
BigInteger result = FastPower.calculate(n, k, m);
21+
assertEquals(result, n.modPow(k, m));
1922
}
2023

2124
@Test
2225
public void test() {
23-
testLong(2,2,10);
24-
testLong(100,1000,20);
25-
testLong(123456,123456789,234);
26+
testLong(2, 2, 10);
27+
testLong(100, 1000, 20);
28+
testLong(123456, 123456789, 234);
2629

27-
testBigInteger(BigInteger.TEN,BigInteger.TEN, BigInteger.valueOf(4));
30+
testBigInteger(BigInteger.TEN, BigInteger.TEN, BigInteger.valueOf(4));
2831
testBigInteger(new BigInteger("123456"), new BigInteger("123456789"), new BigInteger("234"));
2932
testBigInteger(new BigInteger("123456789101112"), new BigInteger("12345678910111213"), new BigInteger("567890"));
3033

0 commit comments

Comments
 (0)