public virtual void FloatEncode() { float value = float.MaxValue; byte[] data = datatype.Encode(value); //Debug.WriteLine( "Max: " + value + "\r\n" + ByteUtil.Dump( data ) ); Assert.True(data.Length == 4); Assert.True(data[0] == 255); Assert.True(data[1] == 255); Assert.True(data[2] == 127); Assert.True(data[3] == 127); value = float.MinValue; data = datatype.Encode(value); //Debug.WriteLine( "Min: " + value + "\r\n" + ByteUtil.Dump( data ) ); Assert.True(data.Length == 4); Assert.True(data[0] == 255); Assert.True(data[1] == 255); Assert.True(data[2] == 127); Assert.True(data[3] == 255); value = 0; data = datatype.Encode(value); //Debug.WriteLine( "Zero: " + value + "\r\n" + ByteUtil.Dump( data ) ); Assert.True(data.Length == 4); Assert.True(data[0] == 0); Assert.True(data[1] == 0); Assert.True(data[2] == 0); Assert.True(data[3] == 0); value = -1; data = datatype.Encode(value); //Debug.WriteLine( "Negative: " + value + "\r\n" + ByteUtil.Dump( data ) ); Assert.True(data.Length == 4); Assert.True(data[0] == 0); Assert.True(data[1] == 0); Assert.True(data[2] == 128); Assert.True(data[3] == 191); }