Sha256: 8bc781f078e4fb038f48bde5f87d10f5889e84a7d76a5fdf160d326a22392d11
Contents?: true
Size: 1.88 KB
Versions: 16
Compression:
Stored size: 1.88 KB
Contents
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package arrow_test import ( "reflect" "testing" "github.com/apache/arrow/go/v10/arrow" ) {{- range .In}} func Test{{.Name}}Traits(t *testing.T) { const N = 10 b1 := arrow.{{.Name}}Traits.CastToBytes([]{{or .QualifiedType .Type}}{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, }) b2 := make([]byte, arrow.{{.Name}}Traits.BytesRequired(N)) for i := 0; i < N; i++ { beg := i * arrow.{{.Name}}SizeBytes end := (i + 1) * arrow.{{.Name}}SizeBytes arrow.{{.Name}}Traits.PutValue(b2[beg:end], {{or .QualifiedType .Type}}(i)) } if !reflect.DeepEqual(b1, b2) { v1 := arrow.{{.Name}}Traits.CastFromBytes(b1) v2 := arrow.{{.Name}}Traits.CastFromBytes(b2) t.Fatalf("invalid values:\nb1=%v\nb2=%v\nv1=%v\nv2=%v\n", b1, b2, v1, v2) } v1 := arrow.{{.Name}}Traits.CastFromBytes(b1) for i, v := range v1 { if got, want := v, {{or .QualifiedType .Type}}(i); got != want { t.Fatalf("invalid value[%d]. got=%v, want=%v", i, got, want) } } v2 := make([]{{or .QualifiedType .Type}}, N) arrow.{{.Name}}Traits.Copy(v2, v1) if !reflect.DeepEqual(v1, v2) { t.Fatalf("invalid values:\nv1=%v\nv2=%v\n", v1, v2) } } {{end}}
Version data entries
16 entries across 16 versions & 1 rubygems