public void Test_SubGridTreeBitmapSubGridBitsTests_Fill() { SubGridTreeBitmapSubGridBits bits = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled); Assert.True(bits.IsEmpty(), "Bits not empty"); bits.Fill(); Assert.True(bits.IsFull(), "Bits not empty after performing a Fill()"); }
public void Test_SubGridTreeBitmapSubGridBitsTests_XORWith() { SubGridTreeBitmapSubGridBits bits1 = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Filled); SubGridTreeBitmapSubGridBits bits2 = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled); SubGridTreeBitmapSubGridBits result = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled); result.XorWith(bits2); Assert.True(result.IsEmpty()); result.XorWith(bits1); Assert.True(result.IsFull()); result.XorWith(bits2); Assert.True(result.IsFull()); result.XorWith(bits1); Assert.True(result.IsEmpty()); }
public void Test_SubGridTreeBitmapSubGridBitsTests_Creation() { // Test the constructor with filled false produces bitmask with all bits set to off SubGridTreeBitmapSubGridBits bits2 = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled); Assert.True(bits2.IsEmpty() && !bits2.IsFull(), "Bits is not empty as expected"); // Test the constructor with filled true produces bitmask with all bits set to on SubGridTreeBitmapSubGridBits bits3 = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Filled); Assert.True(!bits3.IsEmpty() && bits3.IsFull(), "Bits is not full as expected"); }
/// <summary> /// Assign cell information from a previously cached result held in the general sub grid result cache /// using the supplied map to control which cells from the caches sub grid should be copied into this /// client leaf sub grid /// </summary> /// <param name="source"></param> /// <param name="map"></param> public override void AssignFromCachedPreProcessedClientSubGrid(ISubGrid source, SubGridTreeBitmapSubGridBits map) { if (map.IsFull()) { AssignFromCachedPreProcessedClientSubGrid(source); } else { var subGrid = (GenericClientLeafSubGrid <T>)source; map.ForEachSetBit((x, y) => Cells[x, y] = subGrid.Cells[x, y]); } }
public void Test_SubGridTreeBitmapSubGridBitsTests_SetOrOf() { SubGridTreeBitmapSubGridBits bits1 = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Filled); SubGridTreeBitmapSubGridBits bits2 = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled); SubGridTreeBitmapSubGridBits orResult1 = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled); orResult1.SetOrOf(bits1, bits2); Assert.True(orResult1.IsFull(), "SetOrOf did not compute correct result #1"); SubGridTreeBitmapSubGridBits orResult2 = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled); orResult2.SetOrOf(bits1, bits2); Assert.True(orResult2.IsFull(), "SetOrOf did not compute correct result #2"); }
public void Test_SubGridTreeBitmapSubGridBitsTests_FullMask() { SubGridTreeBitmapSubGridBits bits = SubGridTreeBitmapSubGridBits.FullMask; Assert.True(bits.IsFull(), "Bits is not full after being assigned FullMask"); }