LUCENE-7933: relax test to also pass on 32 bit JVMs

This commit is contained in:
Mike McCandless 2017-09-02 05:41:06 -04:00
parent 0807708f50
commit cd471cc98d
1 changed files with 6 additions and 4 deletions

View File

@ -225,7 +225,7 @@ public class TestLongBitSet extends LuceneTestCase {
() -> { () -> {
new LongBitSet(LongBitSet.MAX_NUM_BITS + 1); new LongBitSet(LongBitSet.MAX_NUM_BITS + 1);
}); });
assertEquals("numBits must be 0 .. 137438952384; got: 137438952385", e.getMessage()); assertTrue(e.getMessage().startsWith("numBits must be 0 .. "));
} }
public void testNegativeNumBits() { public void testNegativeNumBits() {
@ -233,7 +233,7 @@ public class TestLongBitSet extends LuceneTestCase {
() -> { () -> {
new LongBitSet(-17); new LongBitSet(-17);
}); });
assertEquals("numBits must be 0 .. 137438952384; got: -17", e.getMessage()); assertTrue(e.getMessage().startsWith("numBits must be 0 .. "));
} }
public void testSmallBitSets() { public void testSmallBitSets() {
@ -360,7 +360,9 @@ public class TestLongBitSet extends LuceneTestCase {
// ... // ...
assertEquals(1 << (32-6), LongBitSet.bits2words(1L << 32)); assertEquals(1 << (32-6), LongBitSet.bits2words(1L << 32));
assertEquals((1 << (32-6)) + 1, LongBitSet.bits2words((1L << 32)) + 1); assertEquals((1 << (32-6)) + 1, LongBitSet.bits2words((1L << 32)) + 1);
// ...
assertEquals(2147483631, LongBitSet.bits2words(LongBitSet.MAX_NUM_BITS)); // ensure the claimed max num_bits doesn't throw exc; we can't enforce exact values here
// because the value variees with JVM:
assertTrue(LongBitSet.bits2words(LongBitSet.MAX_NUM_BITS) > 0);
} }
} }