public void GetBytesFromBooleanTest() { var bc = new SwapBitConverter(); var bytes = new byte[1]; bc.GetBytes(true, bytes, 0); Assert.AreEqual("01", ByteArrayToString(bytes)); bc.GetBytes(false, bytes, 0); Assert.AreEqual("00", ByteArrayToString(bytes)); }
public void GetBytesFromDoubleTest() { var bc = new SwapBitConverter(); var bytes = new byte[8]; bc.GetBytes(1.0, bytes, 0); Assert.AreEqual("3F-F0-00-00-00-00-00-00", ByteArrayToString(bytes)); bc.GetBytes(-1.0, bytes, 0); Assert.AreEqual("BF-F0-00-00-00-00-00-00", ByteArrayToString(bytes)); }
public void GetBytesFromDoubleTest() { var bc = new SwapBitConverter(); var bytes = new byte[8]; bc.GetBytes(1.0, bytes, 0); Assert.AreEqual("3F-F0-00-00-00-00-00-00", ByteArrayToString(bytes)); bc.GetBytes(-1.0, bytes, 0); Assert.AreEqual("BF-F0-00-00-00-00-00-00", ByteArrayToString(bytes)); }
public void GetBytesFromBooleanTest() { var bc = new SwapBitConverter(); var bytes = new byte[1]; bc.GetBytes(true, bytes, 0); Assert.AreEqual("01", ByteArrayToString(bytes)); bc.GetBytes(false, bytes, 0); Assert.AreEqual("00", ByteArrayToString(bytes)); }
public void GetBytesFromUInt64Test() { var bc = new SwapBitConverter(); var bytes = new byte[8]; bc.GetBytes(0UL, bytes, 0); Assert.AreEqual("00-00-00-00-00-00-00-00", ByteArrayToString(bytes)); bc.GetBytes(1UL, bytes, 0); Assert.AreEqual("00-00-00-00-00-00-00-01", ByteArrayToString(bytes)); bc.GetBytes(UInt64.MinValue, bytes, 0); Assert.AreEqual("00-00-00-00-00-00-00-00", ByteArrayToString(bytes)); bc.GetBytes(UInt64.MaxValue, bytes, 0); Assert.AreEqual("FF-FF-FF-FF-FF-FF-FF-FF", ByteArrayToString(bytes)); }
public void GetBytesFromInt32Test() { var bc = new SwapBitConverter(); var bytes = new byte[4]; bc.GetBytes((Int32)0, bytes, 0); Assert.AreEqual("00-00-00-00", ByteArrayToString(bytes)); bc.GetBytes((Int32)1, bytes, 0); Assert.AreEqual("00-00-00-01", ByteArrayToString(bytes)); bc.GetBytes((Int32)(-1), bytes, 0); Assert.AreEqual("FF-FF-FF-FF", ByteArrayToString(bytes)); bc.GetBytes(Int32.MinValue, bytes, 0); Assert.AreEqual("80-00-00-00", ByteArrayToString(bytes)); bc.GetBytes(Int32.MaxValue, bytes, 0); Assert.AreEqual("7F-FF-FF-FF", ByteArrayToString(bytes)); }
public void GetBytesFromInt32Test() { var bc = new SwapBitConverter(); var bytes = new byte[4]; bc.GetBytes((Int32)0, bytes, 0); Assert.AreEqual("00-00-00-00", ByteArrayToString(bytes)); bc.GetBytes((Int32)1, bytes, 0); Assert.AreEqual("00-00-00-01", ByteArrayToString(bytes)); bc.GetBytes((Int32)(-1), bytes, 0); Assert.AreEqual("FF-FF-FF-FF", ByteArrayToString(bytes)); bc.GetBytes(Int32.MinValue, bytes, 0); Assert.AreEqual("80-00-00-00", ByteArrayToString(bytes)); bc.GetBytes(Int32.MaxValue, bytes, 0); Assert.AreEqual("7F-FF-FF-FF", ByteArrayToString(bytes)); }
public void GetBytesFromUInt64Test() { var bc = new SwapBitConverter(); var bytes = new byte[8]; bc.GetBytes(0UL, bytes, 0); Assert.AreEqual("00-00-00-00-00-00-00-00", ByteArrayToString(bytes)); bc.GetBytes(1UL, bytes, 0); Assert.AreEqual("00-00-00-00-00-00-00-01", ByteArrayToString(bytes)); bc.GetBytes(UInt64.MinValue, bytes, 0); Assert.AreEqual("00-00-00-00-00-00-00-00", ByteArrayToString(bytes)); bc.GetBytes(UInt64.MaxValue, bytes, 0); Assert.AreEqual("FF-FF-FF-FF-FF-FF-FF-FF", ByteArrayToString(bytes)); }