public void Test_BitFlagHelperTests_BitOn_byte() { byte value = 0; value = BitFlagHelper.BitOn(value, 0); Assert.Equal(1, value); }
/// <summary> /// Sets the appropriate bits in the GPSModeStore corresponding to the desired pass type /// </summary> /// <param name="value"></param> /// <param name="passType"></param> /// <returns></returns> public static byte SetPassType(byte value, PassType passType) { byte result = value; switch (passType) { case PassType.Front: // val 0 result = BitFlagHelper.BitOff(result, (int)GPSFlagBits.GPSSBit6); result = BitFlagHelper.BitOff(result, (int)GPSFlagBits.GPSSBit7); break; case PassType.Rear: // val 1 result = BitFlagHelper.BitOn(result, (int)GPSFlagBits.GPSSBit6); result = BitFlagHelper.BitOff(result, (int)GPSFlagBits.GPSSBit7); break; case PassType.Track: // val 2 result = BitFlagHelper.BitOff(result, (int)GPSFlagBits.GPSSBit6); result = BitFlagHelper.BitOn(result, (int)GPSFlagBits.GPSSBit7); break; case PassType.Wheel: // val 3 result = BitFlagHelper.BitOn(result, (int)GPSFlagBits.GPSSBit6); result = BitFlagHelper.BitOn(result, (int)GPSFlagBits.GPSSBit7); break; default: throw new ArgumentException($"Unknown pass type supplied to SetPassType {passType}", nameof(passType)); } return(result); }
public void Test_BitFlagHelperTests_BitOn_ushort() { ushort value = 0; value = BitFlagHelper.BitOn(value, 0); Assert.Equal(1, value); }