Some more POW work - it seems to work, but is very, very, extremely slow.

This commit is contained in:
2015-04-14 19:40:10 +02:00
parent daa9a9911b
commit 751ed0c637
3 changed files with 44 additions and 8 deletions

View File

@@ -50,4 +50,18 @@ public class BytesTest {
assertEquals(a.compareTo(b) == -1, Bytes.lt(a.toByteArray(), b.toByteArray()));
}
}
@Test
public void testLowerThanBounded() {
Random rnd = new Random();
for (int i = 0; i < 1000; i++) {
BigInteger a = BigInteger.valueOf(rnd.nextLong()).pow((rnd.nextInt(5) + 1)).abs();
BigInteger b = BigInteger.valueOf(rnd.nextLong()).pow((rnd.nextInt(5) + 1)).abs();
System.out.println("a = " + a.toString(16) + "\tb = " + b.toString(16));
assertEquals(a.compareTo(b) == -1, Bytes.lt(
Bytes.expand(a.toByteArray(), 100),
Bytes.expand(b.toByteArray(), 100),
100));
}
}
}