提交 39ed3a2a authored 作者: LaughingMan's avatar LaughingMan

Remove old test

The method that was tested here was removed back in https://github.com/h2database/h2database/commit/b9ed0d07a8b97fd912d2dc2098f41fe9403fcf11
上级 93e8be5f
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
package org.h2.test.unit; package org.h2.test.unit;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Random;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.test.utils.AssertThrows; import org.h2.test.utils.AssertThrows;
import org.h2.util.MathUtils; import org.h2.util.MathUtils;
...@@ -28,7 +27,6 @@ public class TestMathUtils extends TestBase { ...@@ -28,7 +27,6 @@ public class TestMathUtils extends TestBase {
@Override @Override
public void test() { public void test() {
testRandom(); testRandom();
testReverse();
testFactorial(); testFactorial();
} }
...@@ -53,42 +51,6 @@ public class TestMathUtils extends TestBase { ...@@ -53,42 +51,6 @@ public class TestMathUtils extends TestBase {
assertTrue(data.length > 10); assertTrue(data.length > 10);
} }
private void testReverse() {
assertEquals(Integer.reverse(0), Integer.reverse(0));
assertEquals(Integer.reverse(Integer.MAX_VALUE),
Integer.reverse(Integer.MAX_VALUE));
assertEquals(Integer.reverse(Integer.MIN_VALUE),
Integer.reverse(Integer.MIN_VALUE));
assertEquals(Long.reverse(0), Long.reverse(0L));
assertEquals(Long.reverse(Long.MAX_VALUE), Long.reverse(Long.MAX_VALUE));
assertEquals(Long.reverse(Long.MIN_VALUE), Long.reverse(Long.MIN_VALUE));
for (int i = Integer.MIN_VALUE; i < 0; i += 1019) {
int x = Integer.reverse(i);
assertEquals(Integer.reverse(i), x);
}
for (int i = 0; i > 0; i += 1019) {
int x = Integer.reverse(i);
assertEquals(Integer.reverse(i), x);
}
for (long i = Long.MIN_VALUE; i < 0; i += 1018764321251L) {
long x = Long.reverse(i);
assertEquals(Long.reverse(i), x);
}
for (long i = 0; i > 0; i += 1018764321251L) {
long x = Long.reverse(i);
assertEquals(Long.reverse(i), x);
}
Random random = new Random(10);
for (int i = 0; i < 1000000; i++) {
long x = random.nextLong();
long r = Long.reverse(x);
assertEquals(Long.reverse(x), r);
int y = random.nextInt();
int s = Integer.reverse(y);
assertEquals(Integer.reverse(y), s);
}
}
private void testFactorial() { private void testFactorial() {
new AssertThrows(IllegalArgumentException.class) { @Override new AssertThrows(IllegalArgumentException.class) { @Override
public void test() { public void test() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论