Esempio n. 1
0
        //[Fact(Skip = "Skipped")]
        public void VariantBitConverterLongTest()
        {
            Util.Log("VariantBitConverterLongTest");

            Random random = new Random();

            MemoryStream stream = new MemoryStream();
            long         size   = 0;

            for (int i = 0; i < 1000; i++)
            {
                stream.Position = 0;

                long src = (long)(random.NextDouble() * Int64.MaxValue);
                int  s   = 0;
                VarintBitConverter.SerializeLong(src, stream, out s);
                size            = stream.Position;
                stream.Position = 0;

                long dst = VarintBitConverter.ToLong(stream, out s);

                //Util.Log("src:" + src + ", dst:" + dst + ", size:" + size);

                if (src != dst)
                {
                    throw new InvalidProgramException("index:" + i + ", src:" + src + ", dst:" + dst + ", size:" + size);
                }
            }
        }