public void TestSingleWLESToW() { byte[] result = BitConverter.GetBytes((float)1); ArrayAssertion.AssertByteArrayEquals("converted wbe single", new byte[] { 0x00, 0x00, 0x80, 0x3F }, result); result = BitConverter.GetBytes((float)0.01); ArrayAssertion.AssertByteArrayEquals("converted wbe single (2)", new byte[] { 0x0A, 0xD7, 0x23, 0x3C }, result); result = BitConverter.GetBytes(Single.MaxValue); ArrayAssertion.AssertByteArrayEquals("converted wbe single (3)", new byte[] { 0xFF, 0xFF, 0x7F, 0x7F }, result); result = BitConverter.GetBytes(Single.MinValue); ArrayAssertion.AssertByteArrayEquals("converted wbe single (4)", new byte[] { 0xFF, 0xFF, 0x7F, 0xFF }, result); }
public void TestDoubleWBESToW() { byte[] result = BitConverter.GetBytes(BitConverterUtils.Reverse((double)1)); ArrayAssertion.AssertByteArrayEquals("converted wbe double", new byte[] { 0x3F, 0xF0, 0, 0, 0, 0, 0, 0 }, result); result = BitConverter.GetBytes(BitConverterUtils.Reverse((double)0.01)); ArrayAssertion.AssertByteArrayEquals("converted wbe double (2)", new byte[] { 0x3F, 0x84, 0x7A, 0xE1, 0x47, 0xAE, 0x14, 0x7B }, result); result = BitConverter.GetBytes(BitConverterUtils.Reverse(Double.MaxValue)); ArrayAssertion.AssertByteArrayEquals("converted wbe double (3)", new byte[] { 0x7F, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, result); result = BitConverter.GetBytes(BitConverterUtils.Reverse(Double.MinValue)); ArrayAssertion.AssertByteArrayEquals("converted wbe double (4)", new byte[] { 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, result); }
public void TestUInt64WLESToW() { byte[] result = BitConverter.GetBytes((ulong)1); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 64", new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 }, result); result = BitConverter.GetBytes((ulong)258); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 64 (2)", new byte[] { 2, 1, 0, 0, 0, 0, 0, 0 }, result); result = BitConverter.GetBytes(UInt64.MaxValue); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 64 (3)", new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, result); result = BitConverter.GetBytes(UInt64.MinValue); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 64 (4)", new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, result); }
public void TestUInt64WBESToW() { byte[] result = BitConverter.GetBytes(BitConverterUtils.Reverse((ulong)1)); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 64", new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }, result); result = BitConverter.GetBytes(BitConverterUtils.Reverse((ulong)258)); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 64 (2)", new byte[] { 0, 0, 0, 0, 0, 0, 1, 2 }, result); result = BitConverter.GetBytes(BitConverterUtils.Reverse(UInt64.MaxValue)); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 64 (3)", new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, result); result = BitConverter.GetBytes(BitConverterUtils.Reverse(UInt64.MinValue)); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 64 (4)", new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, result); }
public void TestUInt16WLESToW() { byte[] result = BitConverter.GetBytes((ushort)1); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 16", new byte[] { 1, 0 }, result); result = BitConverter.GetBytes((ushort)258); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 16 (2)", new byte[] { 2, 1 }, result); result = BitConverter.GetBytes(UInt16.MaxValue); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 16 (3)", new byte[] { 0xFF, 0xFF }, result); result = BitConverter.GetBytes(UInt16.MinValue); ArrayAssertion.AssertByteArrayEquals("converted wbe uint 16 (4)", new byte[] { 0x00, 0x00 }, result); }
public void TestInt32WLESToW() { byte[] result = BitConverter.GetBytes((int)1); ArrayAssertion.AssertByteArrayEquals("converted wbe int 32", new byte[] { 1, 0, 0, 0 }, result); result = BitConverter.GetBytes((int)258); ArrayAssertion.AssertByteArrayEquals("converted wbe int 32 (2)", new byte[] { 2, 1, 0, 0 }, result); result = BitConverter.GetBytes(Int32.MaxValue); ArrayAssertion.AssertByteArrayEquals("converted wbe int 32 (3)", new byte[] { 0xFF, 0xFF, 0xFF, 0x7F }, result); result = BitConverter.GetBytes(Int32.MinValue); ArrayAssertion.AssertByteArrayEquals("converted wbe int 32 (4)", new byte[] { 0x00, 0x00, 0x00, 0x80 }, result); }
public void TestInt32WBESToW() { byte[] result = BitConverter.GetBytes(BitConverterUtils.Reverse((int)1)); ArrayAssertion.AssertByteArrayEquals("converted wbe int 32", new byte[] { 0, 0, 0, 1 }, result); result = BitConverter.GetBytes(BitConverterUtils.Reverse((int)258)); ArrayAssertion.AssertByteArrayEquals("converted wbe int 32 (2)", new byte[] { 0, 0, 1, 2 }, result); result = BitConverter.GetBytes(BitConverterUtils.Reverse(Int32.MaxValue)); ArrayAssertion.AssertByteArrayEquals("converted wbe int 32 (3)", new byte[] { 0x7F, 0xFF, 0xFF, 0xFF }, result); result = BitConverter.GetBytes(BitConverterUtils.Reverse(Int32.MinValue)); ArrayAssertion.AssertByteArrayEquals("converted wbe int 32 (4)", new byte[] { 0x80, 0x00, 0x00, 0x00 }, result); }