Example #1
0
        public void Test_BitHelper_SetRange_UInt64(byte start, byte length, ulong flags)
        {
            // Specific initial bit mask to check for unwanted modifications
            const ulong value = 0xAAAA5555AAAA5555u;

            ulong
                backup    = BitHelper.ExtractRange(value, start, length),
                result    = BitHelper.SetRange(value, start, length, flags),
                extracted = BitHelper.ExtractRange(result, start, length),
                restored  = BitHelper.SetRange(result, start, length, backup);

            Assert.AreEqual(extracted, flags);
            Assert.AreEqual(restored, value);
        }
Example #2
0
 public void Test_BitHelper_ExtractRange_UInt32(uint value, byte start, byte length, uint result)
 {
     Assert.AreEqual(result, BitHelper.ExtractRange(value, start, length));
 }