public void GetBits() { ByteMemory memory = new ByteMemory(); memory.SetBytes(0, new byte[] { 0xff, 0xff }); for (int k = 0; k < 16; k++) Assert.IsTrue(memory.GetBit(k)); for (int k = 16; k < 32; k++) Assert.IsFalse(memory.GetBit(k)); }
public void CreateSetAndGetBitVariable() { ByteMemory memory = new ByteMemory(); Variable variable = Variable.MakeBitVariable(10, memory); Assert.AreEqual(false, variable.Value); variable.Value = true; Assert.AreEqual(true, variable.Value); Assert.IsTrue(memory.GetBit(10)); }
public void SetAndGetBitTypeValueUsingMemory() { ByteMemory memory = new ByteMemory(); TypeValue type = BitTypeValue.Instance; type.ToMemory(memory, 10, true); Assert.IsTrue(memory.GetBit(10)); Assert.IsFalse(memory.GetBit(9)); Assert.IsFalse(memory.GetBit(11)); Assert.AreEqual(true, type.FromMemory(memory, 10)); Assert.AreEqual(false, type.FromMemory(memory, 9)); Assert.AreEqual(false, type.FromMemory(memory, 11)); }