Skip to content

Commit

Permalink
LUCENE-7933: relax test to also pass on 32 bit JVMs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemccand committed Sep 2, 2017
1 parent 0807708 commit cd471cc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lucene/core/src/test/org/apache/lucene/util/TestLongBitSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ public void testTooLarge() {
() -> {
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() {
Exception e = expectThrows(IllegalArgumentException.class,
() -> {
new LongBitSet(-17);
});
assertEquals("numBits must be 0 .. 137438952384; got: -17", e.getMessage());
assertTrue(e.getMessage().startsWith("numBits must be 0 .. "));
}

public void testSmallBitSets() {
Expand Down Expand Up @@ -360,7 +360,9 @@ public void testBits2Words() {
// ...
assertEquals(1 << (32-6), LongBitSet.bits2words(1L << 32));
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);
}
}

0 comments on commit cd471cc

Please sign in to comment.