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

Code before:
        test("list<int8>s boundary") do
          # Int8 can hold values from -128 to 127.
          values = [
            [0, -2**7],
            [2**7 - 1],
          ]
          array = Arrow::Array.new(values)
          data_type = Arrow::ListDataType.new(Arrow::Int8DataType.new)

          assert_equal({
                         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)

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

Code after:

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

          assert_equal({
                         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)