Exemplo n.º 1
0
        public unsafe (long, bool) Regular()
        {
            ulong data = 0;

            fixed(byte *s1 = _array)
            {
                var s2      = s1 + 12;
                var s2Limit = s1 + _array.Length;

                return(SnappyCompressor.FindMatchLength(s1, s2, s2Limit, ref data));
            }
        }
Exemplo n.º 2
0
        public unsafe void FindMatchLength(int expectedResult, string s1String, string s2String, int length)
        {
            var array = Encoding.ASCII.GetBytes(s1String + s2String
                                                + new string('\0', Math.Max(0, length - s2String.Length)));

            ulong data = 0;

            fixed(byte *s1 = array)
            {
                byte *s2 = s1 + s1String.Length;

                var result =
                    SnappyCompressor.FindMatchLength(s1, s2, s2 + length, ref data);

                Assert.Equal(result.matchLength < 8, result.matchLengthLessThan8);
                Assert.Equal(expectedResult, result.matchLength);
            }
        }