Example #1
0
        public void byte_array_to_base16_test()
        {
            var value = new byte[] { 0x01, 0xFF, 0x10 };

            Assert.AreEqual("01FF10", ByteUtils.ToBase16(value));
        }
Example #2
0
 public void get_bit_out_of_range_test()
 {
     Assert.Throws <IndexOutOfRangeException>(() =>
                                              ByteUtils.GetBit(0x10, 8));
 }
Example #3
0
        public void format_byte_test()
        {
            const byte value = 0x80;

            Assert.AreEqual("0x80", ByteUtils.FormatByte(value));
        }
Example #4
0
        public void two_digit_from_base16_test()
        {
            const string value = "10";

            Assert.AreEqual(16, ByteUtils.FromBase16(value));
        }
Example #5
0
        public void one_digit_from_base16_test()
        {
            const string value = "F";

            Assert.AreEqual(15, ByteUtils.FromBase16(value));
        }
Example #6
0
        public void ushort_to_base16_test()
        {
            const ushort value = 0x0123;

            Assert.AreEqual("0123", ByteUtils.ToBase16(value));
        }
Example #7
0
        public void byte_to_base16_test()
        {
            const byte value = 0x12;

            Assert.AreEqual("12", ByteUtils.ToBase16(value));
        }
Example #8
0
        public void empty_byte_array_to_base16_test()
        {
            var value = new byte[0];

            Assert.AreEqual(string.Empty, ByteUtils.ToBase16(value));
        }