Exemplo n.º 1
0
        public void CopyBranchNodes_05()
        {
            const int BUCKET_SIZE   = 16;
            var       BRANCH_VALUES = new ushort[]
            {
                11, 12, 13, 14, 15
            };

            const int MAX_VALUES = 5;

            var row = new RowBranch
            {
                Keys = new ushort[BUCKET_SIZE],
            };

            Slicer.CopyBranchNodes(BRANCH_VALUES, 0, MAX_VALUES, BUCKET_SIZE, row);

            for (var i = 0; i < MAX_VALUES; i += 1)
            {
                Assert.AreEqual(BRANCH_VALUES[i], row.Keys[i]);
            }

            for (var i = MAX_VALUES; i < BUCKET_SIZE; i += 1)
            {
                Assert.AreEqual(ushort.MaxValue, row.Keys[i]);
            }
        }
Exemplo n.º 2
0
        public void CopyBranchNodes_17()
        {
            const int TWO_BUCKETS_LONG = 32;
            const int MAX_VALUES       = 17;

            ushort[] BRANCH_VALUES = new ushort[]
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
                11, 12, 13, 14, 15, 16, 17,
            };

            var row = new RowBranch
            {
                Keys = new ushort[TWO_BUCKETS_LONG],
            };

            Slicer.CopyBranchNodes(BRANCH_VALUES, 0, MAX_VALUES, TWO_BUCKETS_LONG, row);

            for (var i = 0; i < MAX_VALUES; i += 1)
            {
                Assert.AreEqual(BRANCH_VALUES[i], row.Keys[i]);
            }

            for (var i = MAX_VALUES; i < TWO_BUCKETS_LONG; i += 1)
            {
                Assert.AreEqual(ushort.MaxValue, row.Keys[i]);
            }
        }
Exemplo n.º 3
0
        public void CopyBranchNodes_01()
        {
            const int MAX_VALUES    = 1;
            var       BRANCH_VALUES = new ushort[]
            {
                1,
            };

            var row = new RowBranch
            {
                Keys = new ushort[MAX_VALUES],
            };

            Slicer.CopyBranchNodes(BRANCH_VALUES, 0, MAX_VALUES, MAX_VALUES, row);

            for (var i = 0; i < MAX_VALUES; i += 1)
            {
                Assert.AreEqual(BRANCH_VALUES[i], row.Keys[i]);
            }
        }
Exemplo n.º 4
0
        public void CopyBranchNodes_16()
        {
            const int MAX_VALUES    = 16;
            var       BRANCH_VALUES = new ushort[]
            {
                201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
                211, 212, 213, 214, 215, 216,
            };

            var row = new RowBranch
            {
                Keys = new ushort[MAX_VALUES],
            };

            Slicer.CopyBranchNodes(BRANCH_VALUES, 0, MAX_VALUES, MAX_VALUES, row);

            for (var i = 0; i < MAX_VALUES; i += 1)
            {
                Assert.AreEqual(BRANCH_VALUES[i], row.Keys[i]);
            }
        }