コード例 #1
0
ファイル: NumericIndexTests.cs プロジェクト: 8thbit/Trie
        public void DefaultIndexBuilderLong()
        {
            var number = 12345678901L;

            var builder = new NumericIndexBuilder<long>();

            var level0Index = builder.Build(number, 0);
            Assert.Equal(new int[] { }, level0Index);

            var level1Index = builder.Build(number, 1);
            Assert.Equal(new[] { 1 }, level1Index);

            var level3Index = builder.Build(number, 3);
            Assert.Equal(new[] { 1, 2, 3 }, level3Index);

            var level10Index = builder.Build(number, 10);
            Assert.Equal(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }, level10Index);
        }
コード例 #2
0
ファイル: NumericIndexTests.cs プロジェクト: 8thbit/Trie
        public void DefaultIndexBuilderByte()
        {
            var number = (byte)123;

            var builder = new NumericIndexBuilder<byte>();

            var level0Index = builder.Build(number, 0);
            Assert.Equal(new int[] { }, level0Index);

            var level1Index = builder.Build(number, 1);
            Assert.Equal(new[] { 1 }, level1Index);

            var level3Index = builder.Build(number, 3);
            Assert.Equal(new[] { 1, 2, 3 }, level3Index);

            var level10Index = builder.Build(number, 10);
            Assert.Equal(new[] { 1, 2, 3 }, level10Index);
        }
コード例 #3
0
ファイル: NumericIndexTests.cs プロジェクト: 8thbit/Trie
        public void DefaultIndexBuilderInt32()
        {
            var number = 1234;

            var builder = new NumericIndexBuilder<int>();

            var level0Index = builder.Build(number, 0);
            Assert.Equal(new int[] { }, level0Index);

            var level1Index = builder.Build(number, 1);
            Assert.Equal(new[] { 1 }, level1Index);

            var level3Index = builder.Build(number, 3);
            Assert.Equal(new[] { 1, 2, 3 }, level3Index);

            var level10Index = builder.Build(number, 10);
            Assert.Equal(new[] { 1, 2, 3, 4 }, level10Index);
        }
コード例 #4
0
        public void DefaultIndexBuilderLong()
        {
            var number = 12345678901L;

            var builder = new NumericIndexBuilder <long>();

            var level0Index = builder.Build(number, 0);

            Assert.Equal(new int[] { }, level0Index);

            var level1Index = builder.Build(number, 1);

            Assert.Equal(new[] { 1 }, level1Index);

            var level3Index = builder.Build(number, 3);

            Assert.Equal(new[] { 1, 2, 3 }, level3Index);

            var level10Index = builder.Build(number, 10);

            Assert.Equal(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }, level10Index);
        }
コード例 #5
0
        public void DefaultIndexBuilderInt32()
        {
            var number = 1234;

            var builder = new NumericIndexBuilder <int>();

            var level0Index = builder.Build(number, 0);

            Assert.Equal(new int[] { }, level0Index);

            var level1Index = builder.Build(number, 1);

            Assert.Equal(new[] { 1 }, level1Index);

            var level3Index = builder.Build(number, 3);

            Assert.Equal(new[] { 1, 2, 3 }, level3Index);

            var level10Index = builder.Build(number, 10);

            Assert.Equal(new[] { 1, 2, 3, 4 }, level10Index);
        }
コード例 #6
0
        public void DefaultIndexBuilderNegativeInt32()
        {
            var number = -1234;

            var builder = new NumericIndexBuilder <int>();

            var level0Index = builder.Build(number, 0);

            Assert.Equal(new int[] {}, level0Index);

            var level1Index = builder.Build(number, 1);

            Assert.Equal(new[] { NumericIndices.MinusPosition }, level1Index);

            var level3Index = builder.Build(number, 3);

            Assert.Equal(new[] { NumericIndices.MinusPosition, 1, 2 }, level3Index);

            var level10Index = builder.Build(number, 10);

            Assert.Equal(new[] { NumericIndices.MinusPosition, 1, 2, 3, 4 }, level10Index);
        }
コード例 #7
0
        public void DefaultIndexBuilderNegativeLong()
        {
            var number = -12345678901L;

            var builder = new NumericIndexBuilder <long>();

            var level0Index = builder.Build(number, 0);

            Assert.Equal(new int[] {}, level0Index);

            var level1Index = builder.Build(number, 1);

            Assert.Equal(new[] { NumericIndices.MinusPosition }, level1Index);

            var level3Index = builder.Build(number, 3);

            Assert.Equal(new[] { NumericIndices.MinusPosition, 1, 2 }, level3Index);

            var level10Index = builder.Build(number, 10);

            Assert.Equal(new[] { NumericIndices.MinusPosition, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, level10Index);
        }
コード例 #8
0
        public void DefaultIndexBuilderNegativeSByte()
        {
            var number = (sbyte)-123;

            var builder = new NumericIndexBuilder <sbyte>();

            var level0Index = builder.Build(number, 0);

            Assert.Equal(new int[] { }, level0Index);

            var level1Index = builder.Build(number, 1);

            Assert.Equal(new[] { NumericIndices.MinusPosition }, level1Index);

            var level3Index = builder.Build(number, 3);

            Assert.Equal(new[] { NumericIndices.MinusPosition, 1, 2 }, level3Index);

            var level10Index = builder.Build(number, 10);

            Assert.Equal(new[] { NumericIndices.MinusPosition, 1, 2, 3 }, level10Index);
        }
コード例 #9
0
        public void DefaultIndexBuilderSByte()
        {
            var number = (sbyte)123;

            var builder = new NumericIndexBuilder <sbyte>();

            var level0Index = builder.Build(number, 0);

            Assert.Equal(new int[] { }, level0Index);

            var level1Index = builder.Build(number, 1);

            Assert.Equal(new[] { 1 }, level1Index);

            var level3Index = builder.Build(number, 3);

            Assert.Equal(new[] { 1, 2, 3 }, level3Index);

            var level10Index = builder.Build(number, 10);

            Assert.Equal(new[] { 1, 2, 3 }, level10Index);
        }
コード例 #10
0
        public void DefaultIndexBuilderUInt16()
        {
            var number = (ushort)1234U;

            var builder = new NumericIndexBuilder <ushort>();

            var level0Index = builder.Build(number, 0);

            Assert.Equal(new int[] { }, level0Index);

            var level1Index = builder.Build(number, 1);

            Assert.Equal(new[] { 1 }, level1Index);

            var level3Index = builder.Build(number, 3);

            Assert.Equal(new[] { 1, 2, 3 }, level3Index);

            var level10Index = builder.Build(number, 10);

            Assert.Equal(new[] { 1, 2, 3, 4 }, level10Index);
        }
コード例 #11
0
ファイル: NumericIndexTests.cs プロジェクト: 8thbit/Trie
        public void DefaultIndexBuilderNegativeInt16()
        {
            var number = (short)-1234;

            var builder = new NumericIndexBuilder<short>();

            var level0Index = builder.Build(number, 0);
            Assert.Equal(new int[] { }, level0Index);

            var level1Index = builder.Build(number, 1);
            Assert.Equal(new[] { NumericIndices.MinusPosition }, level1Index);

            var level3Index = builder.Build(number, 3);
            Assert.Equal(new[] { NumericIndices.MinusPosition, 1, 2 }, level3Index);

            var level10Index = builder.Build(number, 10);
            Assert.Equal(new[] { NumericIndices.MinusPosition, 1, 2, 3, 4 }, level10Index);
        }
コード例 #12
0
ファイル: NumericIndexTests.cs プロジェクト: 8thbit/Trie
        public void DefaultIndexBuilderUInt16()
        {
            var number = (ushort)1234U;

            var builder = new NumericIndexBuilder<ushort>();

            var level0Index = builder.Build(number, 0);
            Assert.Equal(new int[] { }, level0Index);

            var level1Index = builder.Build(number, 1);
            Assert.Equal(new[] { 1 }, level1Index);

            var level3Index = builder.Build(number, 3);
            Assert.Equal(new[] { 1, 2, 3 }, level3Index);

            var level10Index = builder.Build(number, 10);
            Assert.Equal(new[] { 1, 2, 3, 4 }, level10Index);
        }
コード例 #13
0
ファイル: NumericIndexTests.cs プロジェクト: 8thbit/Trie
        public void DefaultIndexBuilderNegativeLong()
        {
            var number = -12345678901L;

            var builder = new NumericIndexBuilder<long>();

            var level0Index = builder.Build(number, 0);
            Assert.Equal(new int[] {}, level0Index);

            var level1Index = builder.Build(number, 1);
            Assert.Equal(new[] {NumericIndices.MinusPosition}, level1Index);

            var level3Index = builder.Build(number, 3);
            Assert.Equal(new[] {NumericIndices.MinusPosition, 1, 2}, level3Index);

            var level10Index = builder.Build(number, 10);
            Assert.Equal(new[] {NumericIndices.MinusPosition, 1, 2, 3, 4, 5, 6, 7, 8, 9}, level10Index);
        }