Source file src/simd/testdata/loadpart_test.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build goexperiment.simdstable
     6  
     7  package testdata_test
     8  
     9  import (
    10  	"simd"
    11  	"testing"
    12  )
    13  
    14  func TestLoadPartCount(t *testing.T) {
    15  	tests := []struct {
    16  		name string
    17  		load func() int
    18  		want int
    19  	}{
    20  		{
    21  			"Int64s",
    22  			func() int {
    23  				_, n := simd.LoadInt64sPart(make([]int64, simd.Int64s{}.Len()+1))
    24  				return n
    25  			},
    26  			simd.Int64s{}.Len(),
    27  		},
    28  		{
    29  			"Uint64s",
    30  			func() int {
    31  				_, n := simd.LoadUint64sPart(make([]uint64, simd.Uint64s{}.Len()+1))
    32  				return n
    33  			},
    34  			simd.Uint64s{}.Len(),
    35  		},
    36  		{
    37  			"Float64s",
    38  			func() int {
    39  				_, n := simd.LoadFloat64sPart(make([]float64, simd.Float64s{}.Len()+1))
    40  				return n
    41  			},
    42  			simd.Float64s{}.Len(),
    43  		},
    44  	}
    45  
    46  	for _, test := range tests {
    47  		t.Run(test.name, func(t *testing.T) {
    48  			if got := test.load(); got != test.want {
    49  				t.Errorf("Load%sPart returned count %d, want %d", test.name, got, test.want)
    50  			}
    51  		})
    52  	}
    53  }
    54  

View as plain text