예제 #1
0
        public virtual void TestFloat()
        {
            var l1 = (float)785412.4875;
            var b2 = ByteArrayConverter.FloatToByteArray(l1);
            var l2 = ByteArrayConverter.ByteArrayToFloat(b2);

            AssertEquals(l1, l2, 0);
        }
        public void It_should_convert_float_to_binary_and_from_binary_to_float_with_the_success()
        {
            const float value = 1.2345678910111213141516171f;

            var byteArray      = ByteArrayConverter.FloatToByteArray(value);
            var convertedValue = ByteArrayConverter.ByteArrayToFloat(byteArray);

            Assert.That(convertedValue, Is.EqualTo(value));
        }