public void EncodeArrayWithOneSimpleByte() { var result = Rlp.EncodeBytes(new byte[] { 0x01 }); Assert.IsNotNull(result); Assert.AreEqual(1, result.Length); Assert.AreEqual(0x01, result[0]); }
public void EncodeNull() { var result = Rlp.EncodeBytes(null); Assert.IsNotNull(result); Assert.AreEqual(1, result.Length); Assert.AreEqual(0x80, result[0]); }
public void EncodeEmptyArray() { var result = Rlp.EncodeBytes(new byte[] { }); Assert.IsNotNull(result); Assert.AreEqual(1, result.Length); Assert.AreEqual(0x80, result[0]); }
public void EncodeArrayWithSingleByte() { for (int k = 0; k <= 0x7f; k++) { var result = Rlp.EncodeBytes(new byte[] { (byte)k }); Assert.IsNotNull(result); Assert.AreEqual(1, result.Length); Assert.AreEqual((byte)k, result[0]); } }
public void EncodeArrayWithHighByte() { for (int k = 0x80; k <= 0xff; k++) { var result = Rlp.EncodeBytes(new byte[] { (byte)k }); Assert.IsNotNull(result); Assert.AreEqual(2, result.Length); Assert.AreEqual(0x81, result[0]); Assert.AreEqual((byte)k, result[1]); } }