Repository: apache/arrow
File: ruby/red-arrow/test/test-array-builder.rb (Ruby)

Code before:
                         data_type: data_type,
                         values: [
                           [0, -128],
                           [127],
                         ],
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,
                       })
        end

        test("list<int16>s inferred from int8 underflow") do
          values = [
            [0, -2**7 - 1],
            [2**7 - 1],
          ]
          array = Arrow::Array.new(values)
          data_type = Arrow::ListDataType.new(Arrow::Int16DataType.new)

          # Int8 lower bound is -128
          assert_equal({
                         data_type: data_type,
                         values: [
                           [0, -129],
                           [127],
                         ],
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,
                       })
        end

        test("list<int16>s inferred from int8 overflow") do
          values = [
            [0, 2**7],
            [-2**7],
          ]
          array = Arrow::Array.new(values)
          data_type = Arrow::ListDataType.new(Arrow::Int16DataType.new)

          # Int8 upper bound is 127
          assert_equal({
                         data_type: data_type,
                         values: [
                           [0, 128],
                           [-128],
                         ],
                       },
                       {

Review comment (suggestion):
```suggestion
                           [0, GLib::MININT8 - 1],
                           [GLib::MAXINT8],
```

Code after:
                         data_type: data_type,
                         values: [
                           [0, GLib::MININT8 - 1],
                           [GLib::MAXINT8],
                         ],
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,
                       })
        end

        test("list<int16>s inferred from int8 overflow") do
          values = [
            [0, GLib::MAXINT8 + 1],
            [GLib::MININT8],
          ]
          array = Arrow::Array.new(values)
          data_type = Arrow::ListDataType.new(:int16)

          assert_equal({
                         data_type: data_type,
                         values: [
                           [0, GLib::MAXINT8 + 1],
                           [GLib::MININT8],
                         ],
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,
                       })
        end

        test("list<int16>s boundary") do
          values = [
            [0, GLib::MININT16],
            [GLib::MAXINT16],
          ]
          array = Arrow::Array.new(values)
          data_type = Arrow::ListDataType.new(:int16)

          assert_equal({
                         data_type: data_type,
                         values: [
                           [0, GLib::MININT16],
                           [GLib::MAXINT16],
                         ],
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,