github.com/vc42/parquet-go@v0.0.0-20240320194221-1a9adb5f23f5/column_buffer_test.go (about) 1 package parquet 2 3 import "testing" 4 5 func TestBroadcastValueInt32(t *testing.T) { 6 buf := make([]int32, 123) 7 broadcastValueInt32(buf, 0x0A) 8 9 for i, v := range buf { 10 if v != 0x0A0A0A0A { 11 t.Fatalf("wrong value at index %d: %v", i, v) 12 } 13 } 14 } 15 16 func TestBroadcastRangeInt32(t *testing.T) { 17 buf := make([]int32, 123) 18 broadcastRangeInt32(buf, 1) 19 20 for i, v := range buf { 21 if v != int32(1+i) { 22 t.Fatalf("wrong value at index %d: %v", i, v) 23 } 24 } 25 } 26 27 func BenchmarkBroadcastValueInt32(b *testing.B) { 28 buf := make([]int32, 1000) 29 for i := 0; i < b.N; i++ { 30 broadcastValueInt32(buf, -1) 31 } 32 b.SetBytes(4 * int64(len(buf))) 33 } 34 35 func BenchmarkBroadcastRangeInt32(b *testing.B) { 36 buf := make([]int32, 1000) 37 for i := 0; i < b.N; i++ { 38 broadcastRangeInt32(buf, 0) 39 } 40 b.SetBytes(4 * int64(len(buf))) 41 }