public void DoubleToBytesConverterTest_epsilon() { //arrange double number = double.Epsilon; string expected = "0000000000000000000000000000000000000000000000000000000000000001"; //act string actual = DoubleToBytes.DoubleToBytesConverter(number); //assert Assert.AreEqual(expected, actual); }
public void DoubleToBytesConverterTest_NaN() { //arrange double number = double.NaN; string expected = "1111111111111000000000000000000000000000000000000000000000000000"; //act string actual = DoubleToBytes.DoubleToBytesConverter(number); //assert Assert.AreEqual(expected, actual); }
public void DoubleToBytesConverterTest_maxvalue() { //arrange double number = double.MaxValue; string expected = "0111111111101111111111111111111111111111111111111111111111111111"; //act string actual = DoubleToBytes.DoubleToBytesConverter(number); //assert Assert.AreEqual(expected, actual); }
public void DoubleToBytesConverterTest_4294967295() { //arrange double number = 4294967295.0; string expected = "0100000111101111111111111111111111111111111000000000000000000000"; //act string actual = DoubleToBytes.DoubleToBytesConverter(number); //assert Assert.AreEqual(expected, actual); }
public void DoubleToBytesConverterTest_255point255() { //arrange double number = 255.255; string expected = "0100000001101111111010000010100011110101110000101000111101011100"; //act string actual = DoubleToBytes.DoubleToBytesConverter(number); //assert Assert.AreEqual(expected, actual); }
public void DoubleToBytesConverterTest_positivenull() { //arrange double number = 0.0; string expected = "0000000000000000000000000000000000000000000000000000000000000000"; //act string actual = DoubleToBytes.DoubleToBytesConverter(number); //assert Assert.AreEqual(expected, actual); }
public void DoubleToBytesConverterTest_positiveInfinity() { //arrange double number = double.PositiveInfinity; string expected = "0111111111110000000000000000000000000000000000000000000000000000"; //act string actual = DoubleToBytes.DoubleToBytesConverter(number); //assert Assert.AreEqual(expected, actual); }
public static void Write(double data, byte[] memoryStream, int startPosition) { DoubleToBytes convert = new DoubleToBytes(); convert.value = data; memoryStream[startPosition] = convert.byte0; memoryStream[startPosition + 1] = convert.byte1; memoryStream[startPosition + 2] = convert.byte2; memoryStream[startPosition + 3] = convert.byte3; memoryStream[startPosition + 4] = convert.byte4; memoryStream[startPosition + 5] = convert.byte5; memoryStream[startPosition + 6] = convert.byte6; memoryStream[startPosition + 7] = convert.byte7; }