Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yifeng-Sigma committed Jun 21, 2024
1 parent 8f140d5 commit 7c1abbd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions go/arrow/array/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ func TestSizeInBytes(t *testing.T) {
var arrayData arrow.ArrayData = data
dataWithChild := NewData(&arrow.StringType{}, 10, buffers1, []arrow.ArrayData{arrayData}, 0, 0)

buffers1[0] = nil
dataWithNilBuffer := NewData(&arrow.StringType{}, 10, buffers1, nil, 0, 0)

t.Run("nil buffers", func(t *testing.T) {
expectedSize := uint64(30)
if actualSize := dataWithNilBuffer.SizeInBytes(); actualSize != expectedSize {
t.Errorf("expected size %d, got %d", expectedSize, actualSize)
}
})

t.Run("buffers only", func(t *testing.T) {
expectedSize := uint64(45)
if actualSize := data.SizeInBytes(); actualSize != expectedSize {
Expand Down

0 comments on commit 7c1abbd

Please sign in to comment.