Example #1
0
        //[Fact(Skip = "Skipped")]
        public void VariantBitConverterUIntTest()
        {
            Util.Log("VariantBitConverterUIntTest");

            Random random = new Random();

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

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

                uint src = (uint)random.Next(int.MinValue, int.MaxValue);

                int s = 0;
                VarintBitConverter.SerializeUInt(src, stream, out s);
                size            = stream.Position;
                stream.Position = 0;

                uint dst = VarintBitConverter.ToUInt(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);
                }
            }
        }