public static Bitflags PrepareSomeFlags() { Bitflags flags = new Bitflags(Bitflags.BLOCKSIZE * 4); flags[0] = true; flags[1] = true; flags[Bitflags.BLOCKSIZE + 0] = true; flags[Bitflags.BLOCKSIZE + 1] = true; flags[Bitflags.BLOCKSIZE + 1] = false; return(flags); }
public static void TestCopy() { var flags = PrepareSomeFlags(); int[] copy = flags.CopyFlags(); copy.Length.ShouldBe(4); copy[0].ShouldBe(3); copy[1].ShouldBe(1); var flagsFromCopy = new Bitflags(copy); flagsFromCopy.Capacity.ShouldBe(flags.Capacity); for (int i = 0; i < flags.Capacity; i++) { flagsFromCopy[i].ShouldBe(flags[i]); } }