public void benNumberEncoding() { byte[] data = Encoding.UTF8.GetBytes("i12345e"); BEncodedNumber number = 12345; Assert.IsTrue(Toolbox.ByteMatch(data, number.Encode())); }
public void benNumberEncoding6() { BEncodedNumber a = -123; BEncodedNumber b = BEncodedNumber.Decode <BEncodedNumber>(a.Encode()); Assert.AreEqual(a.Number, b.Number, "#1"); }
public void benNumberEncoding5() { byte[] data = System.Text.Encoding.UTF8.GetBytes("i-123e"); BEncodedNumber number = -123; Assert.AreEqual(6, number.LengthInBytes()); Assert.IsTrue(Toolbox.ByteMatch(data, number.Encode())); }
public void benNumberEncoding4() { byte[] data = Encoding.UTF8.GetBytes("i-1230e"); BEncodedNumber number = -1230; Assert.AreEqual(7, number.LengthInBytes()); Assert.IsTrue(Toolbox.ByteMatch(data, number.Encode())); }
public void benNumberEncoding3() { byte[] data = System.Text.Encoding.UTF8.GetBytes("i1230e"); BEncodedNumber number = 1230; Assert.Equal(6, number.LengthInBytes()); Assert.True(Toolbox.ByteMatch(data, number.Encode())); }
public void BenNumberEncoding2() { byte[] data = Encoding.UTF8.GetBytes("i0e"); BEncodedNumber number = 0; Assert.Equal(3, number.LengthInBytes()); Assert.True(Toolbox.ByteMatch(data, number.Encode())); }
public void BenNumberEncoding6() { BEncodedNumber actual = -123; var number = BEncodedValue.Decode <BEncodedNumber>(actual.Encode()); Assert.AreEqual(actual.Number, number.Number, "#1"); }
public void benNumberEncodingBuffered() { byte[] data = System.Text.Encoding.UTF8.GetBytes("i12345e"); BEncodedNumber number = 12345; byte[] result = new byte[number.LengthInBytes()]; number.Encode(result, 0); Assert.IsTrue(Toolbox.ByteMatch(data, result)); }
public void BenNumberEncodingBuffered() { var data = Encoding.UTF8.GetBytes("i12345e"); BEncodedNumber number = 12345; var result = new byte[number.LengthInBytes()]; number.Encode(result, 0); Assert.IsTrue(Toolbox.ByteMatch(data, result)); }
public void One() => OneValue.Encode(buffer);
public void Zero() => ZeroValue.Encode(buffer);
public void Smallest() => MinValue.Encode(buffer);
public BEncodedNumberBenchmark() { MaxValue.Encode(buffer); }