Skip to content

Commit

Permalink
Fix bitset tests
Browse files Browse the repository at this point in the history
  • Loading branch information
synhershko committed Jan 16, 2015
1 parent 3ecdbb1 commit bf30302
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Lucene.Net.Core/Support/BitSetSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public static int PrevSetBit(this BitArray bitArray, int index)
public static BitArray And_UnequalLengths(this BitArray bitsA, BitArray bitsB)
{
//Cycle only through fewest bits neccessary without requiring size equality
int maxIdx = Math.Min(bitsA.Length, bitsB.Length);//exclusive
BitArray bits = new BitArray(maxIdx);
var maxIdx = Math.Min(bitsA.Length, bitsB.Length);//exclusive
var bits = new BitArray(maxIdx);
for (int i = 0; i < maxIdx; i++)
{
bitsA[i] = bitsA[i] & bitsB[i];
bits[i] = bitsA[i] & bitsB[i];
}
return bits;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Lucene.Net.Tests/core/Util/TestLongBitSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ internal virtual void DoRandomSets(int maxSize, int iter, int mode)
Assert.AreEqual(a.Cardinality(), b.Cardinality());

BitArray a_and = (BitArray)a.Clone();
a_and = a_and.And(a0);
a_and = a_and.And_UnequalLengths(a0);
BitArray a_or = (BitArray)a.Clone();
a_or = a_or.Or(a0);
a_or = a_or.Or_UnequalLengths(a0);
BitArray a_xor = (BitArray)a.Clone();
a_xor = a_xor.Xor(a0);
a_xor = a_xor.Xor_UnequalLengths(a0);
BitArray a_andn = (BitArray)a.Clone();
a_andn.AndNot(a0);
a_andn.And_UnequalLengths(a0);

LongBitSet b_and = b.Clone();
Assert.AreEqual(b, b_and);
Expand Down

0 comments on commit bf30302

Please sign in to comment.