Пример #1
0
        public void EncodeZeroByteAsOneByte()
        {
            var result = Rlp.EncodeByte(0x00);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Length);
            Assert.AreEqual(0x80, result[0]);
        }
Пример #2
0
        public void EncodeSingleBytesAsOneByte()
        {
            for (int k = 1; k <= 0x7f; k++)
            {
                var result = Rlp.EncodeByte((byte)k);

                Assert.IsNotNull(result);
                Assert.AreEqual(1, result.Length);
                Assert.AreEqual((byte)k, result[0]);
            }
        }
Пример #3
0
        public void EncodeBytesAsTwoBytes()
        {
            for (int k = 0x80; k <= 0xff; k++)
            {
                var result = Rlp.EncodeByte((byte)k);

                Assert.IsNotNull(result);
                Assert.AreEqual(2, result.Length);
                Assert.AreEqual(0x81, result[0]);
                Assert.AreEqual((byte)k, result[1]);
            }
        }