public void ResizeCompactedLongArrayTest(byte bitsPerEntry, byte newBitsPerEntry) { var faker = new Faker(); var array = new CompactedLongArray(bitsPerEntry, 4096); var listOfValues = new List <int>(); for (int i = 0; i < 4096; i++) { int value = faker.Random.Int(0, 15); listOfValues.Add(value); array.Set(i, value); } Assert.Equal(bitsPerEntry, array.BitsPerEntry); array.Resize(newBitsPerEntry); Assert.Equal(newBitsPerEntry, array.BitsPerEntry); for (int i = 0; i < 4096; i++) { int value = array.Get(i); int savedValue = listOfValues[i]; Assert.Equal(savedValue, value); } }
public void CompactedLongArrayMethodsTest(byte bitsPerEntry, int capacity, int value) { var array = new CompactedLongArray(bitsPerEntry, capacity); Assert.Equal(capacity, array.Length); Assert.Equal(bitsPerEntry, array.BitsPerEntry); for (int i = 0; i < capacity; i++) { array.Set(i, value); } for (int i = 0; i < capacity; i++) { Assert.Equal(value, array.Get(i)); } }