github.com/segmentio/parquet-go@v0.0.0-20230712180008-5d42db8f0d47/column_index_internal_test.go (about)

     1  package parquet
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  )
     7  
     8  func TestIncrementByteArrayInplace(t *testing.T) {
     9  	testCases := [][]byte{
    10  		{0x00, 0x01, 0x02, 0x03}, {0x00, 0x01, 0x02, 0x04},
    11  		{0x00, 0x01, 0x02, 0xFF}, {0x00, 0x01, 0x03, 0x00},
    12  		{0x00, 0x01, 0xFF, 0xFF}, {0x00, 0x02, 0x00, 0x00},
    13  		{0xFF, 0xFF, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF, 0xFF},
    14  	}
    15  
    16  	for i := 0; i < len(testCases); i += 2 {
    17  		input := testCases[i]
    18  		expected := testCases[i+1]
    19  		actual := copyBytes(input)
    20  		incrementByteArrayInplace(actual)
    21  		if !bytes.Equal(actual, expected) {
    22  			t.Errorf("incrementByteArrayInplace(%v) = %v, want %v", input, actual, expected)
    23  		}
    24  	}
    25  }