public void AppendDecimal(int count)
                {
                    // Arrange
                    var builder = new Decimal256Array.Builder(new Decimal256Type(14, 10));

                    // Act
                    decimal?[] testData = new decimal?[count];
                    for (int i = 0; i < count; i++)
                    {
                        if (i == count - 2)
                        {
                            builder.AppendNull();
                            testData[i] = null;
                            continue;
                        }
                        decimal rnd = i * (decimal)Math.Round(new Random().NextDouble(), 10);
                        testData[i] = rnd;
                        builder.Append(rnd);
                    }

                    // Assert
                    var array = builder.Build();

                    Assert.Equal(count, array.Length);
                    for (int i = 0; i < count; i++)
                    {
                        Assert.Equal(testData[i], array.GetValue(i));
                    }
                }
            public void Visit(Decimal256Type type)
            {
                Decimal256Array.Builder resultBuilder = new Decimal256Array.Builder(type).Reserve(_baseDataTotalElementCount);

                for (int i = 0; i < _baseDataListCount; i++)
                {
                    List <int?>             dataList = _baseData[i];
                    Decimal256Array.Builder builder  = new Decimal256Array.Builder(type).Reserve(dataList.Count);
                    foreach (decimal?value in dataList)
                    {
                        if (value.HasValue)
                        {
                            builder.Append(value.Value);
                            resultBuilder.Append(value.Value);
                        }
                        else
                        {
                            builder.AppendNull();
                            resultBuilder.AppendNull();
                        }
                    }
                    TestTargetArrayList.Add(builder.Build());
                }

                ExpectedArray = resultBuilder.Build();
            }
                public void AppendThenGetGivesNull()
                {
                    // Arrange
                    var builder = new Decimal256Array.Builder(new Decimal256Type(8, 2));

                    // Act

                    builder = builder.AppendNull();
                    builder = builder.AppendNull();
                    builder = builder.AppendNull();
                    // Assert
                    var array = builder.Build();

                    Assert.Equal(3, array.Length);
                    Assert.Equal(array.Data.Buffers[1].Length, array.ByteWidth * 3);
                    Assert.Null(array.GetValue(0));
                    Assert.Null(array.GetValue(1));
                    Assert.Null(array.GetValue(2));
                }
                public void SwapNull()
                {
                    // Arrange
                    var builder = new Decimal256Array.Builder(new Decimal256Type(24, 8));

                    // Act
                    builder.Append(123.456M);
                    builder.AppendNull();
                    builder.Swap(0, 1);

                    // Assert
                    var array = builder.Build();

                    Assert.Null(array.GetValue(0));
                    Assert.Equal(123.456M, array.GetValue(1));
                }
                public void AppendRangeDecimal()
                {
                    // Arrange
                    var builder = new Decimal256Array.Builder(new Decimal256Type(24, 8));
                    var range   = new decimal[] { 2.123M, 1.5984M, -0.0000001M, 9878987987987987.1235407M };

                    // Act
                    builder.AppendRange(range);
                    builder.AppendNull();

                    // Assert
                    var array = builder.Build();

                    for (int i = 0; i < range.Length; i++)
                    {
                        Assert.Equal(range[i], array.GetValue(i));
                    }

                    Assert.Null(array.GetValue(range.Length));
                }