Ejemplo n.º 1
0
        public void NormalHexString()
        {
            var binary = new byte[1024];

            new Random().NextBytes(binary);
            var hexString = BitConverter.ToString(binary).Replace("-", string.Empty);

            fixed(char *hexStringPtr = hexString)
            {
                var result = CharHelper.CountUsefulCharacters(hexStringPtr, hexString.Length);

                Assert.Equal(hexString.Length, result);
            }
        }
Ejemplo n.º 2
0
        public void UselessCharactersInScalarPart()
        {
            var binary = new byte[8 + 4 + 3];

            new Random().NextBytes(binary);
            var hexString = BitConverter.ToString(binary).Replace("-", string.Empty).ToCharArray();

            hexString[25] = ' ';
            hexString[27] = ' ';

            fixed(char *hexStringPtr = hexString)
            {
                var result = CharHelper.CountUsefulCharacters(hexStringPtr, hexString.Length);

                Assert.Equal(hexString.Length - 2, result);
            }
        }