ToBuffer() public static méthode

public static ToBuffer ( long reading ) : byte[]
reading long
Résultat byte[]
Exemple #1
0
        public void ToBuffer_upper_neg_int()
        {
            int n     = Int16.MinValue - 1;
            var bytes = TelemetryBuffer.ToBuffer(n);

            Assert.Equal(new byte[] { 0xfc, 0xff, 0x7f, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Exemple #2
0
        public void ToBuffer_lower_neg_short()
        {
            var bytes = TelemetryBuffer.ToBuffer(Int16.MinValue);

            Assert.Equal(new byte[] { 0xfe, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Exemple #3
0
        public void ToBuffer_upper_neg_short()
        {
            var bytes = TelemetryBuffer.ToBuffer(-1);

            Assert.Equal(new byte[] { 0xfe, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Exemple #4
0
        public void ToBuffer_Zero()
        {
            var bytes = TelemetryBuffer.ToBuffer(0);

            Assert.Equal(new byte[] { 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Exemple #5
0
        public void ToBuffer_upper_long()
        {
            var bytes = TelemetryBuffer.ToBuffer(Int64.MaxValue);

            Assert.Equal(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }, bytes);
        }
Exemple #6
0
        public void ToBuffer_upper_short()
        {
            var bytes = TelemetryBuffer.ToBuffer(Int16.MaxValue);

            Assert.Equal(new byte[] { 0xfe, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Exemple #7
0
        public void ToBuffer_lower_ushort()
        {
            var bytes = TelemetryBuffer.ToBuffer((long)Int16.MaxValue + 1);

            Assert.Equal(new byte[] { 0x2, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Exemple #8
0
        public void ToBuffer_lower_int()
        {
            var bytes = TelemetryBuffer.ToBuffer((long)UInt16.MaxValue + 1);

            Assert.Equal(new byte[] { 0xfc, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Exemple #9
0
        public void ToBuffer_upper_uint()
        {
            var bytes = TelemetryBuffer.ToBuffer(UInt32.MaxValue);

            Assert.Equal(new byte[] { 0x4, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }, bytes);
        }
Exemple #10
0
        public void ToBuffer_lower_neg_long()
        {
            var bytes = TelemetryBuffer.ToBuffer(Int64.MinValue);

            Assert.Equal(new byte[] { 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80 }, bytes);
        }
Exemple #11
0
        public void ToBuffer_upper_neg_long()
        {
            var bytes = TelemetryBuffer.ToBuffer((long)Int32.MinValue - 1);

            Assert.Equal(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff }, bytes);
        }