Exemple #1
0
        public void WriteRead_First1000()
        {
            for (ulong input = 1; input < 1000; input++)
            {
                var encoded = DynamicUnsignedWriter.WriteAll(1, new List <ulong>()
                {
                    input
                });
                var output = DynamicUnsignedReader.ReadAll(1, encoded);

                Assert.AreEqual(1, output.Count());
                Assert.AreEqual(input, output.First());
            }
        }
Exemple #2
0
        public void WriteRead_First1000_Appending()
        {
            ulong max = 1000;

            var   input = new List <ulong>();
            ulong i;

            for (i = 0; i < max; i++)
            {
                input.Add(i);
            }

            var encoded = DynamicUnsignedWriter.WriteAll(1, input);
            var output  = DynamicUnsignedReader.ReadAll(1, encoded);

            Assert.IsTrue((ulong)output.Count() == max);

            for (i = 0; i < max; i++)
            {
                Assert.AreEqual(i, output.ElementAt((int)i));
            }
        }
Exemple #3
0
        //     LLLLLLVV VVVVVVVV
        //   0 0000000_
        //   1 0000001_
        //   2 00000110
        //   3 00000111
        //   4 00001010 0______
        //   5 00001010 1______
        //   6 00001110 10______
        //   7 00001110 11______


        private ulong TestRead(ulong expectedMinValue, string input)
        {
            return(DynamicUnsignedReader.ReadAll(expectedMinValue, BinaryToByte(input)).First());
        }