Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfbffeb6

Browse files
committed
refactor: update FastPower
1 parent64bd1a1 commitfbffeb6

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
packagesrc.test.java.com.others;
2+
3+
/**
4+
* @author bingo
5+
* @since 2019/5/10
6+
*/
7+
8+
publicclassFastPowerTest {
9+
}

‎src/main/java/com/Others/FastPowerTest.javarenamed 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-
packagesrc.main.java.com.Others;
1+
package src.test.java.com.others;
22

3-
importorg.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-
voidtestLong(longn,longk,longm){
12-
longresult =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-
voidtestBigInteger(BigIntegern,BigIntegerk,BigIntegerm){
17-
BigIntegerresult =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)

[8]ページ先頭

©2009-2025 Movatter.jp