Esempio n. 1
0
        public void benNumberLengthInBytes()
        {
            int            number = 1635;
            BEncodedNumber num    = number;

            Assert.AreEqual(number.ToString().Length + 2, num.LengthInBytes());
        }
Esempio n. 2
0
        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()));
        }
Esempio n. 3
0
        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()));
        }
Esempio n. 4
0
        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()));
        }
Esempio n. 5
0
        public void BenNumberEncoding2()
        {
            byte[]         data   = Encoding.UTF8.GetBytes("i0e");
            BEncodedNumber number = 0;

            Assert.Equal(3, number.LengthInBytes());
            Assert.True(Toolbox.ByteMatch(data, number.Encode()));
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
        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));
        }
Esempio n. 8
0
 public void One() => OneValue.LengthInBytes();
Esempio n. 9
0
 public void Zero() => ZeroValue.LengthInBytes();
Esempio n. 10
0
 public void Largest() => MaxValue.LengthInBytes();
Esempio n. 11
0
 public void Smallest() => MinValue.LengthInBytes();