public void StringSetBytes() { byte[] data = new byte[] { 42, 0, 0, 128 }; // This function should fail on Strings String actual = BitConverterEx.SetBytes <String>(data); }
public void Vector4SetBytes() { Vector4 expected = new Vector4(2.0f, 1.0f, 3.0f, 4.0f); byte[] data = new byte[] { 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 64, 64, 0, 0, 128, 64 }; Vector4 actual = BitConverterEx.SetBytes <Vector4>(data); Assert.AreEqual(expected, actual); }
public void UInt32SetBytes() { UInt32 expected = 2147483690; byte[] data = new byte[] { 42, 0, 0, 128 }; UInt32 actual = BitConverterEx.SetBytes <UInt32>(data); Assert.AreEqual(expected, actual); }
public void Int32SetBytes() { Int32 expected = 42; byte[] data = new byte[] { 42, 0, 0, 0 }; Int32 actual = BitConverterEx.SetBytes <Int32>(data); Assert.AreEqual(expected, actual); }
public void DoubleSetBytes() { Double expected = System.Math.PI; byte[] data = new byte[] { 24, 45, 68, 84, 251, 33, 9, 64 }; Double actual = BitConverterEx.SetBytes <Double>(data); Assert.AreEqual(expected, actual); }
public void SingleSetBytes() { Single expected = (Single)System.Math.PI; byte[] data = new byte[] { 219, 15, 73, 64 }; Single actual = BitConverterEx.SetBytes <Single>(data); Assert.AreEqual(expected, actual); }
public void ColorExSetBytes() { ColorEx expected = new ColorEx(ColorEx.BurlyWood); byte[] data = new byte[] { 0, 0, 128, 63, 222, 222, 94, 63, 184, 184, 56, 63, 136, 135, 7, 63 }; ColorEx actual = BitConverterEx.SetBytes <ColorEx>(data); Assert.AreEqual(expected.ToString(), actual.ToString()); }