Skip to content

Commit fe51d5b

Browse files
committed
remove ToBitArray from interface
1 parent d352c2d commit fe51d5b

4 files changed

Lines changed: 34 additions & 44 deletions

File tree

Source/IBitset.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ public interface IBitset : IEnumerable, System.Runtime.Serialization.ISerializab
6363
/// <returns>a new IBitSet</returns>
6464
IBitset Difference(IBitset otherSet);
6565

66-
/// <summary>
67-
/// Returns the contents of this set as a bit array where the value is
68-
/// set to true for each index that is a member of this set
69-
/// </summary>
70-
/// <returns>a new BitArray</returns>
71-
BitArray ToBitArray();
72-
7366
bool Equals(object obj);
7467

7568
/// <summary>

Source/RoaringBitset.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -740,10 +740,5 @@ public void DifferenceWith(IBitset otherSet)
740740
}
741741

742742
}
743-
744-
public BitArray ToBitArray()
745-
{
746-
throw new NotImplementedException();
747-
}
748743
}
749744
}

Tests/BaseBitSetTests.cs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -216,38 +216,6 @@ public virtual void DifferenceTest()
216216
Assert.AreEqual(true, mixedDiffSet2.Get(4));
217217
}
218218

219-
[TestMethod]
220-
public virtual void ToBitArrayTest()
221-
{
222-
int[] set = SetGenerator.GetRandomArray(TEST_SET_LENGTH);
223-
BitArray setArray = new BitArray(TEST_SET_LENGTH);
224-
225-
foreach (int index in set)
226-
{
227-
setArray[index] = true;
228-
}
229-
230-
IBitset testSet = CreateSetFromIndices(set, TEST_SET_LENGTH);
231-
BitArray testArray = testSet.ToBitArray();
232-
233-
bool expected = true;
234-
bool actual = true;
235-
236-
for (int i = 0; i < setArray.Length; i++)
237-
{
238-
if (setArray[i])
239-
{
240-
actual &= setArray[i] == testArray[i];
241-
}
242-
else
243-
{
244-
//do nothing
245-
}
246-
}
247-
248-
Assert.AreEqual(expected, actual);
249-
}
250-
251219
[TestMethod]
252220
public virtual void CardinalityTest()
253221
{

Tests/RLEBitsetTests.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.VisualStudio.TestTools.UnitTesting;
22
using System;
3+
using System.Collections;
34
using System.Collections.Generic;
45
using System.Linq;
56
using System.Text;
@@ -34,5 +35,38 @@ public virtual void SerializationTest()
3435
Assert.AreEqual(actual, expected);
3536
}
3637

38+
[TestMethod()]
39+
public virtual void ToBitArrayTest()
40+
{
41+
int TEST_SET_LENGTH = 10;
42+
int[] set = SetGenerator.GetRandomArray(TEST_SET_LENGTH);
43+
BitArray setArray = new BitArray(TEST_SET_LENGTH);
44+
45+
foreach (int index in set)
46+
{
47+
setArray[index] = true;
48+
}
49+
50+
RLEBitset testSet = (RLEBitset)CreateSetFromIndices(set, TEST_SET_LENGTH);
51+
BitArray testArray = testSet.ToBitArray();
52+
53+
bool expected = true;
54+
bool actual = true;
55+
56+
for (int i = 0; i < setArray.Length; i++)
57+
{
58+
if (setArray[i])
59+
{
60+
actual &= setArray[i] == testArray[i];
61+
}
62+
else
63+
{
64+
//do nothing
65+
}
66+
}
67+
68+
Assert.AreEqual(expected, actual);
69+
}
70+
3771
}
3872
}

0 commit comments

Comments
 (0)