github.com/parquet-go/parquet-go@v0.20.0/encoding/delta/delta_test.go (about)

     1  package delta_test
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/parquet-go/parquet-go/encoding/delta"
     8  	"github.com/parquet-go/parquet-go/encoding/fuzz"
     9  	"github.com/parquet-go/parquet-go/encoding/test"
    10  )
    11  
    12  func FuzzDeltaBinaryPackedInt32(f *testing.F) {
    13  	fuzz.EncodeInt32(f, new(delta.BinaryPackedEncoding))
    14  }
    15  
    16  func FuzzDeltaBinaryPackedInt64(f *testing.F) {
    17  	fuzz.EncodeInt64(f, new(delta.BinaryPackedEncoding))
    18  }
    19  
    20  func FuzzDeltaLengthByteArray(f *testing.F) {
    21  	fuzz.EncodeByteArray(f, new(delta.LengthByteArrayEncoding))
    22  }
    23  
    24  func FuzzDeltaByteArray(f *testing.F) {
    25  	fuzz.EncodeByteArray(f, new(delta.ByteArrayEncoding))
    26  }
    27  
    28  const (
    29  	encodeMinNumValues = 0
    30  	encodeMaxNumValues = 200
    31  )
    32  
    33  func TestEncodeInt32(t *testing.T) {
    34  	for bitWidth := uint(0); bitWidth <= 32; bitWidth++ {
    35  		t.Run(fmt.Sprintf("bitWidth=%d", bitWidth), func(t *testing.T) {
    36  			test.EncodeInt32(t,
    37  				new(delta.BinaryPackedEncoding),
    38  				encodeMinNumValues,
    39  				encodeMaxNumValues,
    40  				bitWidth,
    41  			)
    42  		})
    43  	}
    44  }
    45  
    46  func TestEncodeInt64(t *testing.T) {
    47  	for bitWidth := uint(0); bitWidth <= 64; bitWidth++ {
    48  		t.Run(fmt.Sprintf("bitWidth=%d", bitWidth), func(t *testing.T) {
    49  			test.EncodeInt64(t,
    50  				new(delta.BinaryPackedEncoding),
    51  				encodeMinNumValues,
    52  				encodeMaxNumValues,
    53  				bitWidth,
    54  			)
    55  		})
    56  	}
    57  }