Esempio n. 1
0
        public override void BeforeClass()
        {
            base.BeforeClass();

            Random random = Random;

            INTS              = new int[COUNT];
            LONGS             = new long[COUNT];
            RANDOM_TEST_BYTES = new byte[COUNT * (5 + 4 + 9 + 8)];
            ByteArrayDataOutput bdo = new ByteArrayDataOutput(RANDOM_TEST_BYTES);

            for (int i = 0; i < COUNT; i++)
            {
                int i1 = INTS[i] = random.Next();
                bdo.WriteVInt32(i1);
                bdo.WriteInt32(i1);

                long l1;
                if (Rarely())
                {
                    // a long with lots of zeroes at the end
                    l1 = LONGS[i] = TestUtil.NextInt64(random, 0, int.MaxValue) << 32;
                }
                else
                {
                    l1 = LONGS[i] = TestUtil.NextInt64(random, 0, long.MaxValue);
                }
                bdo.WriteVInt64(l1);
                bdo.WriteInt64(l1);
            }
        }
Esempio n. 2
0
            // encodes count values to buffer
            internal virtual void EncodeValues(int count)
            {
                @out.Reset(buffer);
                long lastOrd = 0;

                for (int i = 0; i < count; i++)
                {
                    ords.MoveNext();
                    long ord = ords.Current.Value;
                    @out.WriteVInt64(ord - lastOrd);
                    lastOrd = ord;
                }
            }
Esempio n. 3
0
            // encodes count values to buffer
            private void EncodeValues(int count)
            {
                @out.Reset(buffer);
                long lastOrd = 0;

                for (int i = 0; i < count; i++)
                {
                    if (!ords.MoveNext())
                    {
                        break;
                    }

                    long ord = ords.Current.Value;
                    @out.WriteVInt64(ord - lastOrd);
                    lastOrd = ord;
                }
            }